如何在Visual Studio 2015中使用clang编译C ++ for Windows [英] How to compile C++ for Windows with clang in Visual Studio 2015
问题描述
据我所知,Visual Studio 2015是随附的。。首先我虽然这只是为Android和iOS应用程序,但根据
As far as I understand, Visual Studio 2015 is shipped with clang. First I though this was only for Android and iOS apps, but according to this article it should also be possible to use the clang++ frontend for Windows programs. However, I can't find the according option.
So could you please explain to me, how I can change the used compiler to clang in a c++ project (in VS2015 RC Community Edition).
Starting with VS2015 Update 1 you can install the "Clang with Microsoft CodeGen" template via the New Project window, browse to Installed -> Templates -> Visual C++ -> Cross Platform.
You will then be able to choose the Clang 3.7 with Microsoft CodeGen v140_clang_3_7
Platform Toolset in the properties page of any Windows C++ project.
Clang has a completely different set of command-line options which it recognizes, so when using the v140_clang_3_7
toolset, the project properties must be using Clang-compatible options, which can be recognized as starting with -
instead of /
. For example, Debug Information Format property set to "Full Debug Information (DWARF2) (-g2 -gdwarf-2
)", and Enable C++ Exceptions property set to "Yes (-fexceptions
)".
There's more information in this blog post.
这篇关于如何在Visual Studio 2015中使用clang编译C ++ for Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!