When enabling C++11 with stdlibc++ 4.7, clang error out, while gcc compiles fine

后端 未结 3 1862
萌比男神i
萌比男神i 2020-12-10 05:26

I have been trying to get C++11 to work, after browsing different websites and Q/A, i am still having trouble with. I want to use clang with libstdc++. It is indicated in th

3条回答
  •  半阙折子戏
    2020-12-10 06:30

    Why are you saying -I/opt/local/include/gcc47/c++ ?

    That should not be necessary with either GCC or Clang, and will not work. Not all libstdc++ headers are under that path, there are some essential headers elsewhere that define things like _GLIBCXX_BEGIN_NAMESPACE_VERSION

    It doesn't fail with GCC because GCC already knows how to find the other headers, so it's redundant to explicitly use -I and -L options. It doesn't work with Clang because you are only telling it how to find some of the headers it needs, but not telling it how to find the rest.

    Stop trying to override the compiler's standard library paths, let it use the built-in paths it already knows about.

提交回复
热议问题