Nor*_*löw 4 c++ redundancy gcc clang c++-standard-library
我已经~/alt
在Ubuntu 12.04上使用GCC-4.6成功构建并安装(在前缀下)LLVM-Clang主干(2012年4月23日),并使用此Clang-build成功使用libc ++.当我想使用它时,我必须提供两种-lc++
,-libstdc++
如下所示
/home/per/alt/bin/clang -x c++ -I/home/per/alt/include/v1 -L/home/per/alt/lib -std=gnu++0x -g -Wall ~/f.cpp -lm -lc++ -lstdc++ -lpthread -o f
Run Code Online (Sandbox Code Playgroud)
编译f.cpp
包含
#include <iostream>
using std::cout;
using std::endl;
int main(int argc, const char * argv[]) {
cout << "sxx" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我省略,-lstdc++
我会收到链接错误
/home/per/alt/include/v1/ostream:989: error: undefined reference to '__cxa_begin_catch'
/home/per/alt/include/v1/ostream:993: error: undefined reference to '__cxa_end_catch'
/home/per/alt/include/v1/ostream:993: error: undefined reference to '__cxa_end_catch'
/tmp/f-4l9mgl.o(.eh_frame+0xd3): error: undefined reference to '__gxx_personality_v0'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Compilation exited abnormally with code 1 at Tue Apr 24 13:59:22
Run Code Online (Sandbox Code Playgroud)
不libc++
应该完全替代libstdc++
?
libcxx没有附带ABI层...这就是libcxxabi存在的原因.
从理论上讲,您应该可以链接到libcxxabi.
实际上,您可能希望链接到libsupc ++或libcxxrt
最近在新闻组上进行了一些讨论,我担心解决方案很复杂且不断变化:http: //thread.gmane.org/gmane.comp.compilers.clang.devel/19782
归档时间: |
|
查看次数: |
4246 次 |
最近记录: |