Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

g++ undefined reference to ZMQ

Tags:

c++

g++

zeromq

I developed my project on my workplace pc (where all is going well), but when I try to compile on my home pc (both ubuntu 12.04) I get the following message:

undefined reference to `zmq_sendmsg'

I can't understand what am I missing, since I see this

/usr/local/lib/libzmq.so
/usr/local/lib/libzmq.so.3
/usr/local/lib/libzmq.so.3.0.0

so my ZeroMQ installation seems to be ok. Can someone suggest what could I check?

like image 280
Leonardo Spina Avatar asked Jan 16 '23 00:01

Leonardo Spina


2 Answers

When you link you have to add -lzmq so the linker will pull in functions from libzmq.

Here's how I compile a hello world program:

gcc -o hello hello.c -lzmq
like image 71
Pieter Hintjens Avatar answered Jan 24 '23 13:01

Pieter Hintjens


We need the linker command you use to be able to tell.

Can you build some of the ZeroMQ example programs? Can you build things with the v2 versions in Ubuntu, eg

edd@max:~$ COLUMNS=40 dpkg -l|grep libzmq
ii  libzmq-dev     2.1.11-1ubuntu ZeroMQ lightweight messaging kernel (develop
ii  libzmq1        2.1.11-1ubuntu ZeroMQ lightweight messaging kernel (shared 
edd@max:~$ 

ZeroMQ is a pretty standard library as far as build tools go, so you must be missing something simple we should find.

like image 45
Dirk Eddelbuettel Avatar answered Jan 24 '23 14:01

Dirk Eddelbuettel