Set as default C++11 in Clang

2019-04-08 11:02发布

问题:

The LLVM C++ compiler has full support for C++11 standard. Is there a way to set C++11 as the default standard without adding -std=c++11 compiler flag every time? I tried setting CCXFLAGS environment variable to -std=c++11, but with no luck.

回答1:

Use clang 6.0.0 or higher. The default C++ dialect is now C++14.

http://releases.llvm.org/6.0.1/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang