windowsc++11clangcompiler-flags

How to add std=c++11 flag to clang-cl?


I tried to compile a C++11 program with clang-cl under Windows. Clang-cl is the wrapper around clang to be more compatible with cl (Visual Studio compiler). I tried to add -std=c++11 and /std=c++11 and both get rejected. This is to no surprise as cl has no C++11 flag. But I can not use C++11 features with clang-cl.

How can I enable C++11 support in clang-cl?


Solution

  • In the documentation mentioned before says: http://clang.llvm.org/docs/UsersManual.html#clang-cl

    clang defaults to C++11 for Windows targets.

    Maybe you don't need to pass any flag to clang-cl.