我已经建造和安装(前缀下~/alt
成功使用GCC-4.6在Ubuntu 12.04和反过来的libc ++使用该锵建造LLVM -锵干线(2012年4月23日))。 当我想用它,我必须同时提供-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
编译f.cpp
含
#include <iostream>
using std::cout;
using std::endl;
int main(int argc, const char * argv[]) {
cout << "sxx" << endl;
return 0;
}
如果我省略-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
应该不是libc++
是一个完全替代libstdc++
?