I am using Mac, and i use homebrew to install zeromq. I want to use zeromq for my application. I tried to compile zmq.hpp https://github.com/zeromq/cppzmq/blob/master/zmq.hpp with
int main () {
// Prepare our context and socket
zmq::context_t context (1);
zmq::socket_t socket (context, ZMQ_REP);
socket.bind ("tcp://*:5555");
while (true) {
zmq::message_t request;
// Wait for next request from client
socket.recv (&request);
std::cout << "Received Hello" << std::endl;
// Do some 'work'
sleep (1);
// Send reply back to client
zmq::message_t reply (5);
memcpy ((void *) reply.data (), "World", 5);
socket.send (reply);
}
return 0;
}
but it failed. The error shows
"frameworks/zmq/zmq.hpp:377:35: error: expected ';' at end of declaration list socket_t (const socket_t&) ZMQ_DELETED_FUNCTION; ^ ; frameworks/zmq/zmq.hpp:379:42: error: expected ';' at end of declaration list void operator = (const socket_t&) ZMQ_DELETED_FUNCTION;"
Why is this happened? The zmq.hpp code does not contain any errors. Please help.
Finally I do this and it worked.
#if __has_feature(cxx_deleted_functions)
#define ZMQ_DELETED_FUNCTION = delete
#else
#define ZMQ_DELETED_FUNCTION
#endif
Thanks a lot. Audrey.