Compiling with Clang using Libc++ undefined references

让人想犯罪 __ 提交于 2019-11-28 21:10:03

I believe libc++ doesn't support all exception functions yet. See the status page:

http://libcxxabi.llvm.org/spec.html

You could probably link against gnu's libstdc++

Here's what works for me with the Ubuntu Vivid packages for clang and libc++:

clang++ -std=c++11 -stdlib=libc++ <object files> -lc++abi -lsupc++

It is important that the object files come before the -l flags, e.g. when you use exceptions. Obviously, this still will not link if you use libraries compiled against libstdc++ and use any STL types in those interfaces.

This seems like you are using exception handling, but it isn't enabled in the compiler. Try passing -fexceptions to the commandline.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!