使用Libc ++编译未定义的引用 [英] Compiling with Clang using Libc++ undefined references
问题描述
第一对夫妇太长,无法参考。我得到这个错误,当我试图从SVN编译 clang ++ -stdlib = libc ++ ../main.cc ...
与clang和libc ++。
The first couple are too long to reference. I get this error when I try to compile clang++ -stdlib=libc++ ../main.cc ...
with clang and libc++ from the SVN.
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 ++似乎有点不完整,但它仍然是我的第一选择,当它完成。
SOLUTION: Thanks to one of the answers, I know the solution. libc++ can't be used by itself like libstdc++, it has to be linked along with libc++abi. However, libc++abi isn't complete yet, so using libc++ seems to be a little incomplete for the moment, but it is still my first choice when it completes.
UPDATE 5/26/2012: libc ++ abi现在完成了C ++和我一直使用clang ++如下成功 clang ++ -std = c ++ 11 -stdlib = libc ++ -lc ++ abi
。
UPDATE 5/26/2012: libc++abi is now complete for C++ and I have been using clang++ as follows successfully clang++ -std=c++11 -stdlib=libc++ -lc++abi
.
推荐答案
我相信libc ++不支持所有的异常函数。查看状态页:
I believe libc++ doesn't support all exception functions yet. See the status page:
http://libcxxabi.llvm.org/ spec.html
您可能会连结到gnu的libstdc ++
You could probably link against gnu's libstdc++
这篇关于使用Libc ++编译未定义的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!