[zeromq-dev] Example for building against ZMQ with CMake + UDP Multicast Support
Luca Boccassi
luca.boccassi at gmail.com
Tue Jan 10 21:59:39 CET 2017
On 10 January 2017 at 20:47, Stephan Opfer <opfer at vs.uni-kassel.de> wrote:
> On 10.01.2017 17:28, Luca Boccassi wrote:
>>
>> As always on *NIX, use pkg-config and your life will be much easier.
>>
>> eg:
>>
>> g++ `pkg-config --cflags --libs libzmq` foo.cpp -o foo
>
> Ok, with pkg-config I can compile, but the linker is still complaining.
>
> Here is my command for compiling:
>
> g++ -DZMQ_BUILD_DRAFT_API=1 -I/usr/local/include -L/usr/local/lib -lzmq
> Discovery.cpp -o foo
>
> "pkg-config --cflags --libs libzmq" created "-DZMQ_BUILD_DRAFT_API=1
> -I/usr/local/include -L/usr/local/lib -lzmq", which seems right as far as I
> can tell.
>
> Here some linker errors:
>
> /tmp/ccLV8vrk.o: In function `main':
> Discovery.cpp:(.text+0x24e): undefined reference to `zmq_ctx_new'
> Discovery.cpp:(.text+0x28c): undefined reference to `zmq_socket'
> Discovery.cpp:(.text+0x2a7): undefined reference to `zmq_socket'
> Discovery.cpp:(.text+0x2c2): undefined reference to `zmq_bind'
> Discovery.cpp:(.text+0x2fe): undefined reference to `zmq_leave'
> Discovery.cpp:(.text+0x369): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x3a5): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x3e1): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x41d): undefined reference to `zmq_connect'
> Discovery.cpp:(.text+0x528): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x55a): undefined reference to `zmq_sleep'
> Discovery.cpp:(.text+0x5f8): undefined reference to `zmq_leave'
> Discovery.cpp:(.text+0x62a): undefined reference to `zmq_sleep'
> Discovery.cpp:(.text+0x70c): undefined reference to `zmq_poll'
> Discovery.cpp:(.text+0x7ab): undefined reference to `zmq_close'
> Discovery.cpp:(.text+0x7e2): undefined reference to `zmq_close'
> Discovery.cpp:(.text+0x819): undefined reference to `zmq_ctx_term'
> collect2: error: ld returned 1 exit status
Did you install the packages? Because then /usr/local is wrong, if you
did a make install before you should do a make uninstall to remove the
manually installed files
More information about the zeromq-dev
mailing list