在linux下静态链接库存在,但是在链接过程会出现undefined reference的错误
2013-04-18 22:16
357 查看
如题,使用linux编译程序时,需要静态链接库。
在链接过程也已指定静态库的路径及库名,且链接器能找到指定的库,但会提示库中被调用的函数undefined reference
这是需要检查链接库在链接命令中的位置,要保证依赖该库的中间文件或库在它的前面。
即若一个程序需要liba.a libb.a a.o这三个文件链接生成,libb.a依赖liba.a, a.out 依赖 libb.a 则在命令中顺序应为 a.o libb.a liba.a。这样也许能解决静态链接库undefined reference的错误。
但是出现该错误的原因可能不是只 此一种,仅是出现类似问题的一种参考。
在链接过程也已指定静态库的路径及库名,且链接器能找到指定的库,但会提示库中被调用的函数undefined reference
这是需要检查链接库在链接命令中的位置,要保证依赖该库的中间文件或库在它的前面。
即若一个程序需要liba.a libb.a a.o这三个文件链接生成,libb.a依赖liba.a, a.out 依赖 libb.a 则在命令中顺序应为 a.o libb.a liba.a。这样也许能解决静态链接库undefined reference的错误。
但是出现该错误的原因可能不是只 此一种,仅是出现类似问题的一种参考。
相关文章推荐
- 在安装linux X86-64的Oracle10201时,在链接过程中出现gcc错误
- undefined reference to ceil 链接错误
- linux链接时提示"undefined reference to" 问题解决方法
- Linux下链接相互依赖的.a文件遇到undefined reference问题总结
- Linux下编译C++程序遇到错误:undefined reference to '***'
- Linux下编译代码错误: undefined reference to symbol 'cos@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: err
- 在liunx编译C语言程序出现Undefined reference to pthread_create in Linux 错误*
- 使用muduo编译链接错误 undefined reference to `muduo::ThreadPool::run(boost::function<void ()()>&&)'
- 移植uip-0.9到u-boot中出现undefined reference to `flash_info'错误的分析过程
- undefined reference to `clock_gettime' 链接错误问题解决
- 为什么会出现undefined reference to ''错误
- undefined reference to `clock_gettime' 链接错误问题解决
- 链接错误 undefined reference to 'atexit'
- linux 链接库文件出现“undefined reference to" 问题的解决方法
- 编译链接错误undefined reference to
- 编译mtk的android工程,会出现如图所示的错误: undefined reference to “
- GCC版本不兼容导致的链接错误:undefined reference to `SomeFunction'
- 对于动态数据库链接出现undefined reference to `dlclose' 的错误
- Linux下链接库出现的undefined reference问题总结
- CMake 包含了头文件 找到了so动态库 链接时仍然出现undefined reference to 错误