【发布时间】:2013-08-21 18:50:04
【问题描述】:
在构建/编译时出现此错误:
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> -
@DennisMeng 我试过了,没什么区别
-
那么,那个头文件到底在哪里?
-
@DennisMeng 它在我的程序文件中,安装了 zmq 的源代码及其包含的库。
-
您确定
socket_t和context_t是在zmq.h中定义的吗?
标签: c++ build compilation declaration zeromq