[zeromq-dev] C++ programming help (Was not: Various Majordomo protocol versions)

jim at melton.space jim at melton.space
Fri Mar 13 15:18:43 CET 2020


Actually, I suspect the opposite. My memory is fuzzy but I think zmq::socket_t overloads operator*, making me think you started with a pointer and need ANOTHER *. You can look in /usr/include/zmq.hpp (NOT .h), or according to The Fine Manual:

To obtain a ØMQ socket for use in a zmq_pollitem_t structure, you should cast an instance of the socket_t class to (void *).

because it implements operator void* but you must invoke it explicitly. 
—
Jim Melton (sent from my iPhone)
(303) 829-0447
http://blogs.melton.space/pharisee/

> On Mar 13, 2020, at 07:51, Brett Viren <brett.viren at gmail.com> wrote:
> 
> Hi Simon,
> 
> This apparently has nothing to do with majordomo protocol versions.
> 
> It would help if you show your code but based on the small hints, I
> agree with Brian.  Remove the "*" in front of "sock".
> 
> If the build failed to find cppzmq header files you'd see much different
> errors.
> 
> -Brett.
> 
> SIMON BABY <simonkbaby at gmail.com> writes:
> 
>> Thanks Brian . I think I am missing some cppzmq package . I am not sure which version I have to use .
>> 
>> On Friday, March 13, 2020, Brian T. Carcich <briantcarcich at gmail.com> wrote:
>> 
>> I don't have time to be sure, and I don't have your code, but I think the asterisks before [sock] and
>> [eplt->get().sock] are turning (zmq::socket_t*) POINTERS to zmq::socket_t class objects into
>> (zmq::socket_t) class objects, and the C++ compiler can cast the former into (void*) pointer, but
>> not the latter.
>> 
>> Best regards.
>> 
>> On Fri, Mar 13, 2020 at 1:23 AM SIMON BABY <simonkbaby at gmail.com> wrote:
>> 
>> []...]
>> 
>> src/zipcpp.cpp:125:53: error: cannot convert ‘zmq::socket_t’ to ‘void*’ in initialization
>> 
>>      pollitem_t pollItem = { *sock, 0, ZMQ_POLLIN, 0 };
>> 
>>     [...]
>> 
>> src/zipcpp.cpp:380:69: error: cannot convert ‘zmq::socket_t’ to ‘void*’ in initialization
>> 
>>          pollitem_t pollItem = { *epIt->get().sock, 0, ZMQ_POLLIN, 0 };  // no constructor for
>> pollitem_t
>> 
>> _______________________________________________
>> 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
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200313/4901067d/attachment.htm>


More information about the zeromq-dev mailing list