在使用Boost 1.53的链接阶段未定义的引用
undefined references during link phase using Boost 1.53
我在Red Hat Linux rel 5.5上使用g++ 4.1.2和Boost 1.53。在链接过程中有一个问题,我不清楚。我得到错误消息:
/usr/local/boost_1_53_0/stage/lib/libboost_thread.so:
undefined reference to `std::bad_exception::what() const@GLIBCXX_3.4.9'
/usr/local/boost_1_53_0/stage/lib/libboost_thread.so:
undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9'
collect2: ld returned 1 exit status
似乎有一个问题与我链接的libstdc++.so
文件版本有关。如果我交替隐藏和显示这个文件,我可以让我的程序链接。但是,我希望能够像在介绍Boost库和并发线程之前那样一步完成。
请尝试通过yum
安装
yum install boost
你不会遇到这样的问题。
尝试包含rpmforge和epel yum库
http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning显示GLIBCXX_3.4.9
是libstdc++.so
从GCC 4.2.0使用的符号版本,所以如果Boost库想要那个版本,那么它意味着它是用GCC 4.2.x编译的
这意味着你不能在GCC 4.1.2链接的程序中使用该库,你需要链接到GCC 4.2.0或更高版本
libstdc++.so
是向后兼容的,但不是向前兼容的,所以你可以用一个版本编译程序并将其链接到一个新版本,但你不能用一个新版本编译程序并链接到一个旧版本。
相关文章:
- 链接器输入文件未使用,因为链接未完成,我无法获得.o
- CURL 静态链接未解析的外部符号
- OCCI 链接:未定义的符号
- CMAKE OS X CLION.如何链接自定义动态库
- C++链接未定义的引用
- 静态库链接 已定义符号的问题"Undefined symbols"
- 如何链接自定义静态库
- 如何设置 CMAKE 静态链接(未定义对 'dlopen' 的引用)?
- MFC 静态链接未解析的外部符号
- Visual Studio C++链接未使用的全局变量
- 如何在静态库中的单独 cpp 文件中链接未引用的变量
- C++链接是否足够聪明,可以避免链接未使用的库
- MinGW 与 MSVC 的 dll 库问题链接(未定义的引用)
- SDL2_mixer链接未定义引用C::B
- g++.exe[警告]链接器输入文件未使用,因为链接未完成
- c++链接自定义.so库,然后与JNI
- 在单独的.cpp文件和生成文件链接中定义的类外部的 C++ 函数
- 将犰狳/布拉斯/拉帕克与 cmake 链接(未定义对"dgemv_"的引用)
- 在 Ubuntu 12.04 上链接 - 未定义对"clock_gettime@GLIBC_2.17"的引用
- 在Makefile中链接时定义变量的问题