Johan Engblom
Johan Engblom

Reputation: 215

zGuide for zeroMQ fails compilation

I'm trying to build the zguide c++ examples, but the compilation fails. Here is the error ouput:

asyncsrv.cpp: In member function ‘void client_task::start()’:
asyncsrv.cpp:37:70: error: cannot convert ‘zmq::socket_t’ to ‘void*’ in initialization zmq::pollitem_t items[] = {{client_socket_, 0, ZMQ_POLLIN, 0}};

asyncsrv.cpp: In member function ‘void server_task::run()’: asyncsrv.cpp:140:52: error: cannot convert ‘zmq::socket_t’ to ‘void*’ for argument ‘1’ to ‘void zmq::proxy(void*, void*, void*)’ zmq::proxy(frontend_, backend_, nullptr);

Upvotes: 1

Views: 1634

Answers (1)

SRC
SRC

Reputation: 435

If you are using a C++11 compiler , see that your zmq.hpp is latest and replace the line

zmq::pollitem_t items[] = {{client_socket_, 0, ZMQ_POLLIN, 0}};

by

std::vector<zmq::pollitem_t> items = {{static_cast<void *>(client_socket_), 0, ZMQ_POLLIN, 0}};

and the line

zmq::proxy(frontend_, backend_, nullptr);

by

zmq::proxy(static_cast<void *>(frontend_), static_cast<void *>(backend_), nullptr);

Upvotes: 8

Related Questions