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

Ravi Joshi ravi.joshi53 at yahoo.com
Sun Nov 26 02:39:47 CET 2017

Hi Mykola,

As always, thank you very much.

I am surprised. I used the following command to install ZeroMQ:
sudo apt-get install libzmq3-dev

I am using Ubuntu 14.04 LTS 64 Bit OS.

Thanks again.


On Sunday, 26 November 2017 12:01 AM, Mykola Ostrovskyy via zeromq-dev <zeromq-dev at lists.zeromq.org> wrote:


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


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

>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 )
>______________________________ _________________
>zeromq-dev mailing list
>zeromq-dev at lists.zeromq.org
>https://lists.zeromq.org/ mailman/listinfo/zeromq-dev

zeromq-dev mailing list
zeromq-dev at lists.zeromq.org

More information about the zeromq-dev mailing list