Compiling with Clang using Libc++ undefined references

前端 未结 3 1364
离开以前
离开以前 2020-12-14 16:11

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.

相关标签:
3条回答
  • 2020-12-14 16:26

    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.

    0 讨论(0)
  • 2020-12-14 16:34

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

    0 讨论(0)
  • 2020-12-14 16:45

    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++

    0 讨论(0)
提交回复
热议问题