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

不想你离开。 提交于 2019-12-06 06:30:32

问题


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?


回答1:


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.




回答2:


From official docs:

/std:<standard>



回答3:


For any future visitors, using /std:c++17 for clang-cl works for me. Notice that there is no equals sign after std.



来源:https://stackoverflow.com/questions/25992401/how-to-add-std-c11-flag-to-clang-cl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!