nor*_*lli 27 c++ std clang undefined-reference libc++
第一对夫妇太长,无法参考.当我尝试clang++ -stdlib=libc++ ../main.cc ...
使用SVN中的clang和libc ++ 进行编译时,我收到此错误.
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'
Run Code Online (Sandbox Code Playgroud)
解决方案:感谢其中一个答案,我知道解决方案.libc ++本身不能像libstdc ++那样使用,它必须与libc ++ abi一起链接.但是,libc ++ abi尚未完成,因此目前使用libc ++似乎有些不完整,但它仍然是我完成时的首选.
更新2012年5月26日: libc ++ abi现在已经完成了C++,我已经成功地使用了clang ++ clang++ -std=c++11 -stdlib=libc++ -lc++abi
.