Leonardo Spina
Leonardo Spina

Reputation: 680

g++ undefined reference to ZMQ

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?

Upvotes: 4

Views: 7726

Answers (2)

Pieter Hintjens
Pieter Hintjens

Reputation: 6669

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

Upvotes: 8

Dirk is no longer here
Dirk is no longer here

Reputation: 368201

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.

Upvotes: 1

Related Questions