前面几个太长了,我尝试使用从SVN获取的clang和libc ++编译clang++ -stdlib = libc ++ ../main.cc ...
时出现了这个错误。
error: undefined reference to 'typeinfo for char const*'
error: undefined reference to '__cxa_allocate_exception'
error: undefined reference to '__cxa_throw'
/tmp/cc-pbn00y.o:../main.cc:function std::__1::deque<double, std::__1::allocator<double> >::__add_back_capacity(): error: undefined reference to '__cxa_begin_catch'
/tmp/cc-pbn00y.o:../main.cc:function std::__1::deque<double, std::__1::allocator<double> >::__add_back_capacity(): error: undefined reference to '__cxa_rethrow'
/tmp/cc-pbn00y.o:../main.cc:function std::__1::deque<double, std::__1::allocator<double> >::__add_back_capacity(): error: undefined reference to '__cxa_end_catch'
/tmp/cc-pbn00y.o(.eh_frame+0xbd3): error: undefined reference to '__gxx_personality_v0'
解决方案:感谢其中一位回答者,我知道了解决方案。libc++不能像libstdc++那样单独使用,它必须与libc++abi一起链接。然而,libc++abi目前还不完整,所以在这个时候使用libc++似乎有点不完整,但当它完成后,它仍然是我的首选。
更新 5/26/2012: libc++abi现在已经完整支持C ++,我已经成功地使用clang++如下 clang++ -std=c++11 -stdlib=libc++ -lc++abi
。