[zeromq-dev] Error: no matching function for call to ‘zmq::socket_t::setsockopt(int, int)’

Mykola Ostrovskyy spambox03 at mail.ru
Sat Nov 25 16:01:22 CET 2017


Ravi,

It looks like you have a very old version of zmq.hpp header. Both of those
methods are templates added along with C++11 support [1].
Check if you have them, if not, you can either update the header or use
non-template methods:

    int timeout = 1000;
    zmq_socket.setsockopt(ZMQ_RCVTIMEO, &timeout, sizeof(timeout));

    unsigned char* byteptr = static_cast<unsigned char*>(msg.data());


[1]
https://github.com/zeromq/cppzmq/commit/34c8e4395c94d34a89bbeaaf2b8f9c94a8293c84


Regards,
Mykola



2017-11-25 14:24 GMT+02:00 Ravi Joshi via zeromq-dev <
zeromq-dev at lists.zeromq.org>:

> Hi,
> I am trying to use a subscriber in C++ in the following way:
> zmq_socket.setsockopt(ZMQ_RCVTIMEO, 1000);
>
> But the above line is throwing following error:
> no matching function for call to ‘zmq::socket_t::setsockopt(int, int)’
>
>
> I am also trying to receive published byte array using following code:
> unsigned char* byteptr = msg.data<unsigned char>();
>
> But the above line is throwing following error:
> error: expected primary-expression before ‘unsigned’
>
> Please check out the following Pastebin link in order to see the complete
> code (https://pastebin.com/XEYduhaD)
>
> -
> Thanks
> Ravi
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20171125/f40490ff/attachment.htm>


More information about the zeromq-dev mailing list