[zeromq-dev] ZeroMQ C++

Brian T. Carcich briantcarcich at gmail.com
Sat Jul 27 02:44:23 CEST 2019


Simon,

I would guess it's the asterisk before [epit_>...], which converts the
(socket_t*) - i.e. the pointer to a socket_t instance - returned by
[epit->get().sock into a socket_t instance.  C++ can convert the pointer to
the socket_t, or to any object, into a (void*), but it can't convert the
object itself to a pointer.

Drop those asterisks and you should be okay.

Brian Carcich

On Fri, Jul 26, 2019 at 12:40 AM SIMON BABY <simonkbaby at gmail.com> wrote:

> Thank you Michal. While building my code, I see below error. can anyone
> suggest to fix this.
>
> tdy at ubuntu:~/ZIPCpp$ make all
> mkdir -p build/src/fmt/
> g++ -O2 -std=c++11 -fPIC -Wall -Wextra -fmessage-length=0 -pthread
> -I/cppzmq/ -Iinclude -MMD -MP -c src/fmt/posix.cc -o
> build/src/fmt/posix.cc.o
> mkdir -p build/src/fmt/
> g++ -O2 -std=c++11 -fPIC -Wall -Wextra -fmessage-length=0 -pthread
> -I/cppzmq/ -Iinclude -MMD -MP -c src/fmt/format.cc -o
> build/src/fmt/format.cc.o
> mkdir -p build/src/
> g++ -O2 -std=c++11 -fPIC -Wall -Wextra -fmessage-length=0 -pthread
> -I/cppzmq/ -Iinclude -MMD -MP -c src/zipc.cpp -o build/src/zipc.cpp.o
> src/zipc.cpp: In function ‘bool zipc::sockPoll(zmq::socket_t*, int)’:
> src/zipc.cpp:115:53: error: cannot convert ‘zmq::socket_t’ to ‘void*’ in
> initialization
>      pollitem_t pollItem = { *sock, 0, ZMQ_POLLIN, 0 };
>                                                      ^
> src/zipc.cpp: In static member function ‘static std::vector<unsigned int>
> zipc::Endpoint::pollEndpoints(const EndpointList&, int)’:
> s*rc/zipc.cpp:365: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
>                                                                      ^
> src/zipc.cpp: In member function ‘void zipc::Proxy::run()’:
> *src/zipc.cpp:545:78: error: cannot convert ‘zmq::socket_t’ to ‘void*’ for
> argument ‘1’ to ‘void zmq::proxy_steerable(void*, void*, void*, void*)’*
>      proxy_steerable(*this->feSock, *this->beSock, nullptr,
> *this->ctlPullSock);
>
>     ^
> src/zipc.cpp: At global scope:
> src/zipc.cpp:58:6: warning: ‘void zipc::mpmsgListSend(zipc::MPMsgList&,
> zmq::socket_t*, int)’ defined but not used [-Wunused-function]
>  void mpmsgListSend(MPMsgList &mpmsgList, socket_t *sock, int flags)
>       ^
> src/zipc.cpp:70:6: warning: ‘bool zipc::msgRecvPoll(zipc::Msg&,
> zmq::socket_t*, int)’ defined but not used [-Wunused-function]
>  bool msgRecvPoll(Msg &msg, socket_t *sock, int timeoutMs)
>       ^
> src/zipc.cpp:129:6: warning: ‘void zipc::sockDetach(zmq::socket_t*, const
> string&, zipc::AttachType)’ defined but not used [-Wunused-function]
>  void sockDetach(socket_t *sock, const std::string &epAddr, AttachType
> attachType)
>       ^
> Makefile:50: recipe for target 'build/src/zipc.cpp.o' failed
> make: *** [build/src/zipc.cpp.o] Error 1
> tdy at ubuntu:~/ZIPCpp$ uname -a
> Linux ubuntu 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:13
> UTC 2017 i686 i686 i686 GNU/Linux
>
>
> Rgds
> Simon
>
> On Thu, Jul 25, 2019 at 1:06 PM Michal Vyskocil <michal.vyskocil at gmail.com>
> wrote:
>
>> Hi,
>>
>> Just use zpoller from czmq. It is C library, but with really nice API you
>> can call from C++ code
>>
>> Dne čt 25. 7. 2019 19:33 uživatel Brett Viren via zeromq-dev <
>> zeromq-dev at lists.zeromq.org> napsal:
>>
>>> SIMON BABY <simonkbaby at gmail.com> writes:
>>>
>>> > I am looking for a sample source code in c++ with multiple end-points
>>> defined in the same process.
>>> > Basically my process has to send a receive messages to/from other
>>> processes.
>>>
>>> These two requirements seem contradictory to me.
>>>
>>> In any case, the zmqpp package has tests written in C++ that have
>>> multiple sockets in the same process.
>>>
>>>
>>> https://github.com/zeromq/zmqpp/blob/develop/src/tests/test_socket.cpp#L84
>>>
>>> I happen to develop in C++ and use libczmq.  Although it is a C library,
>>> there has been nothing that limits me using it with C++.
>>>
>>> -Brett.
>>>
>>> _______________________________________________
>>> 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/20190726/570ed595/attachment.htm>


More information about the zeromq-dev mailing list