Clang : Failed to find C++11 headers

2019-08-29 02:31发布

问题:

I am trying to build all the examples in the Crow library with clang 3.6 and I can see the CC/CXX has been found properly by using clang 3.6. It uses cmake which I am not quite familiar with.

However it failed to find C++11 headers.

Error is like:

'future' file not found

It seems that the libstdc++ is not specified properly, or some people reckon it needs to build the clang libstdc++ myself.

Anyone can shed some light on this will be much appreciated.

回答1:

So based on the previous comment the issue is that you don't enable the C++ 11 mode in Clang.

As in referenced question, the issue is simply that you do not say to Clang (or in future for GCC) to look for C++ headers.

"Clang's command line is gcc-compatible so you have to enable C++11 support via the followinf command-line switch"

-std=c++11

If after this you all you have to do is to write your C++ 11 code. If you use Makefiles you should add to your CXX arguments the command line switch to Clang.



标签: c++ c++11 clang