Compiling with Clang using Libc++ undefined references

前端 未结 3 1366
离开以前
离开以前 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++  -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.

    提交回复
    热议问题