LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Resolving sem_* link errors on Linux (https://www.linuxquestions.org/questions/programming-9/resolving-sem_%2A-link-errors-on-linux-310113/)

ceoping 04-05-2005 05:35 PM

Resolving sem_* link errors on Linux
 
Hi,

I am having difficulty resolving this link errors with one of the file. Is there a particular library that I missed or need to include when using semaphore.h?

Platform: Linux

>>semtest.o: In function `main':
>>semtest.o(.text+0x18): undefined reference to `sem_unlink'
>>semtest.o(.text+0x69): undefined reference to `sem_open'
>>semtest.o(.text+0x104): undefined reference to `sem_wait'
>>semtest.o(.text+0x184): undefined reference to `sem_getvalue'
>>semtest.o(.text+0x233): undefined reference to `sem_post'
>>collect2: ld returned 1 exit status
>>make: *** [semtest] Error 1

Any help would be appreciated. I am stuck at this point.

Thanks,

kl

keefaz 04-06-2005 10:02 AM

Maybe try to link it with libpthread (-lpthread)

grep sem_unlink /lib/libpthread-0.10.so
-->Binary file /lib/libpthread-0.10.so matches

ceoping 04-07-2005 11:32 AM

I link with -lrt and it went away for now.


All times are GMT -5. The time now is 04:41 AM.