Skip to contentSkip to conversation

ipc

DISCUSSION raja 3 participants 4 messages Jul 7, 2005

lore
Share & tools
lore

raja

author
#0 lore raw

Hi,
While working with posix ipc i used the function mq_open. When i compiled using gcc i am getting error as

: undefined reference to `mq_open'
collect2: ld returned 1 exit status

will you please tell me how to avoid that.

Thanking you,
raja

#1 lore raw
Quoted 8 lines · On Thu, 07 Jul 2005 17:01:51 +0530 raja <[email protected]> wrote:

Hi,
While working with posix ipc i used the function mq_open. When i compiled using gcc i am getting error as

: undefined reference to `mq_open'
collect2: ld returned 1 exit status

will you please tell me how to avoid that.

Also this has nothing to do with kernel, stop posting here these questions.

----

You need to tell GCC to use "libmqueue"... something like this:

gcc -Wall -O2 -o prog prog.c -lmqueue

Please read this book for other generic programming questions:
http://www.advancedlinuxprogramming.com/

And use Google.

Signature · 2 lines
	Paolo Ornati
	Linux 2.6.12.2 on x86_64
#2 lore raw
Quoted 3 lines · Paolo Ornati

You need to tell GCC to use "libmqueue"... something like this:

gcc -Wall -O2 -o prog prog.c -lmqueue

If you have glibc 2.3.4 or later, you should use -lrt instead.

Jakub

#3 lore raw
Quoted 1 line · On Thu, 7 Jul 2005 08:27:48 -0400 Jakub Jelinek <[email protected]> wrote:

If you have glibc 2.3.4 or later, you should use -lrt instead.

Yes... I was just saying that he forgot to add "-lLIBRAY_NAME" :)

Signature · 2 lines
	Paolo Ornati
	Linux 2.6.12.2 on x86_64