提升链接错误未定义引用GLIBCXX_3.4

时间:2013-12-20 09:44:53

标签: c++ boost cmake

我正在尝试使用ubuntu下的clang链接boost。我得到以下错误:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_filesystem.a(operations.o): undefined reference to symbol '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4'
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已将find_package(Boost COMPONENTS file_system,system)添加到cmake。知道什么可能导致这个错误吗?

1 个答案:

答案 0 :(得分:9)

这个错误是因为Boost是使用gcc标准库libstdc ++构建的,我正在使用clang libc ++进行编译。

以前我使用apt-get下载的Boost。从boost.org下载源代码并使用clang及其标准库手动编译修复了这个问题。

相关问题