构建/编译时我遇到了这个错误:
C:\Ethe\main.cpp: In function 'int main()':
C:\Ethe\main.cpp:11:4: error: 'zmq' has not been declared
C:\Ethe\main.cpp:11:19: error: expected ';' before 'context'
C:\Ethe\main.cpp:12:4: error: 'zmq' has not been declared
C:\Ethe\main.cpp:12:18: error: expected ';' before 'socket'
C:\Ethe\main.cpp:14:4: error: 'zmq' has not been declared
main.cpp:
#include <zmq.h>
#include <iostream>
#include <string>
int main()
{
std::string tip;
std::cout << "Enter Target IP: ";
std::cin >> tip;
zmq::context_t context (1);
zmq::socket_t socket (context, ZMQ_REQ);
std::cout << "Connecting to " << tip << std::endl;
zmq::socket.connect ("tcp://"+tip+":5555");
return 0;
}
有没有人对如何解决这个问题有什么想法?
#include "zmq.h"
而不是#include <zmq.h>
。 - Dennis Mengsocket_t
和context_t
在zmq.h
中被定义了吗? - olevegard#include
时,编译器和链接器不会自动查找每个可能的文件夹;它们只会在特定的位置进行查找。 - Dennis Meng