首页 > 其他 > 详细

undefined reference to `shm_unlink'

时间:2014-12-16 09:55:28      阅读:1261      评论:0      收藏:0      [点我收藏+]

1、问题描述:

在编译一个程序的时候提示这样的错误:

BLog.cpp:(.text+0x5fc): undefined reference to `shm_unlink‘
DBLog.cpp:(.text+0x610): undefined reference to `shm_open‘
/home/SCS/install/lib/liblog4cplus.a(timehelper.o): In function `log4cplus::helpers::Time::gettimeofday()‘:
/mnt/hgfs/07svn/program/SDK/log4plus/log4cplus-1.1.0/log4cplus-1.1.0/src/timehelper.cxx:102: undefined reference to `clock_gettime‘
/home/SCS/install/lib/liblog4cplus.a(sleep.o): In function `unix_nanosleep‘:
/mnt/hgfs/07svn/program/SDK/log4plus/log4cplus-1.1.0/log4cplus-1.1.0/src/sleep.cxx:52: undefined reference to `clock_nanosleep‘
collect2: ld 返回 1

2、解决办法

在前面编译的时候还没出错,只是将原来链接的liblog4cplus.so改为liblog4cplus.a,然后编译就出错了,网上搜了一下在需要加上-lrt选项,编译通过了。

3、-lrt

http://www.lehman.cuny.edu/cgi-bin/man-cgi?librt+3

rt库是运行时库,提供了一些额外的函数定义。

undefined reference to `shm_unlink'

原文:http://www.cnblogs.com/lit10050528/p/4166351.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!