使用gcc 5 编译c++11编写的程序 出现的符号找不到的链接问题。
来源:互联网 发布:qq飞车 知乎 编辑:程序博客网 时间:2024/06/05 16:13
记录今天遇到的问题:
1. 使用c++11 写了一段c++程序,使用gcc 5.2编译。程序引用了非c++11编写的静态库
2. 链接时总是报某个函数找不到 但是使用nm命令查看,符号确实存在
经过google发现,原来gcc 5引入了新的ABI
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
If you get linker errors about undefined references to symbols that involve types in the std::__cxx11
namespace or the tag [abi:cxx11]
then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.
对于我的问题,需要在参数上增加 -D_GLIBCXX_USE_CXX11_ABI=0 就解决了。
- 使用gcc 5 编译c++11编写的程序 出现的符号找不到的链接问题。
- C程序的编译和链接 - gcc
- 使用GCC手动C 的编译链接
- 解决Maven编译(maven install)时,出现的“找不到符号”的问题
- 解决Maven编译(maven install)时,出现的“找不到符号”的问题
- javac编译出现“找不到符号”和"软件包不存在"的解决
- c 程序的编译链接
- 关于vs2010 C++编译链接总是出现“LNK:2019 无法解析的外部符号”的问题
- GCC的使用(编译,链接,运行)
- GCC编译C程序需要注意文件名后缀的问题
- jenkins 用 Maven 打包出现 找不到符号 问题的解决方法
- 【C++】gcc/g++ 链接库的编译与链接
- 在linux gcc 64位平台编译动态链接库时出现的问题
- 1.2.在linux环境实践,使用vim编写一个程序,然后使用gcc查看【预处理】、【编译】、【汇编】、【链接】各阶段文件的内容。并熟悉相关指令。
- GCC的链接问题
- GCC编译c程序的工作过程
- GCC编译C程序的四个步骤
- linux GCC -- C程序的编译
- php调试代码
- SQL中truncate table和delete的区别
- eclipse 编译tomcat8.0.26的源码
- Google New Grad 两轮电面经历分享
- dedecms如何使用投票模块?
- 使用gcc 5 编译c++11编写的程序 出现的符号找不到的链接问题。
- 方法重载和继承
- Tomact启动自动执行程序的三种方式
- Cortex-M4架构
- ###Jsp+Servlet购物商城day03.3:生成订单。【重中之重:保存多表信息】:使用事物,dao两个方法分别插入主表和从表信息。
- 时间换算函数
- Python 批量合并多个txt文件
- Spark---性能调优之广播共享数据
- LeetCode 143. Reorder List