c++ - error: 'zmq' has not been declared -


when building/compiling getting error:

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 " << tip << std::endl;    zmq::socket.connect ("tcp://"+tip+":5555");     return 0; } 

anyone got ideas on how can fix this?

you need add #include <zmq.hpp> include c++ api of libzmq. however, in zmq verions 2.x version included install, nowadays in zmq-3.x.y version not shipped library anymore, can see http://github.com/zeromq/zeromq3-x/raw/master/news

the c++ api excluded core library since less more strategy zeromq. still downloadable from: https://github.com/zeromq/cppzmq/blob/master/zmq.hpp

this header written around c structures , functions c api zeromq, therefore entire c++ api single headerfile. downloadable link above.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -