Use any C++ Compiler with Visual Studio

Will Buik

Microsoft Visual Studio 2017 supports several C++ compilers to suit a wide variety of codebases.  In addition to the Microsoft Visual C++ compiler that many of you are likely familiar with, Visual Studio 2017 also supports Clang, GCC, and other compilers when targeting certain platforms.

This post is intended to familiarize you with the variety of C++ compilers that are compatible with the Visual Studio IDE, and to understand when they might be applicable to use with your projects.  Some compilers may be better suited to your needs depending on your project or target.  Alternatively, you may be interested in checking out new language features, such as C++ Concepts, that are not available across all compilers without needing to leave the IDE.

You can select the compiler and corresponding toolset that will be used to build a project with the “Platform Toolset” property under General Configuration Properties for C++ projects.  Any installed compilers that are applicable to your project type will be listed in the “Platform Toolset” dropdown.

Microsoft C++ Compiler (MSVC)

If you are targeting Windows, the Microsoft C++ compiler (MSVC) may be the way to go.  This is the default compiler for most Visual Studio C++ projects and is recommended if you are targeting Windows.

Compiler options for the Microsoft C++ compiler.
Compiler options for the Microsoft C++ compiler.


You can use the Clang compiler with Visual Studio to target Android, iOS, and Windows.

If you are targeting Android, you can use the Clang/LLVM compiler that ships with the Android NDK and toolchain to build your project.  Likewise, Visual Studio can use Clang running on a Mac to build projects targeting iOS.  Support for Android and iOS is included in the “Mobile Development with C++” workload.  For more information about targeting Android or iOS check out our posts tagged with the keywords “Android” and “iOS”.

If you are targeting Windows, you have a few options:

  1. Use Clang/LLVM; “Clang for Windows” includes instructions to install Clang/LLVM as a platform toolset in Visual Studio.
  2. Use Clang to target Windows with Clang/C2 (Clang frontend with Microsoft Code Generation).

Compiler options for the Clang/C2 compiler.
Compiler options for the Clang/C2 compiler.

It might make sense to use Clang/C2 if you want to bring a codebase that takes advantage of Clang’s language features to the Windows platform.  Since the code generation and optimization is handled by the MSVC backend, binaries produced by Clang/C2 are fully compatible with binaries produced by MSVC.  You can learn more about Clang/C2 from Clang with Microsoft Codegen – or check out the latest updates in posts tagged with the keyword “clang”.


If your project targets Linux or Android, you can consider using GCC.  Visual Studio’s C++ Android development natively supports building your projects with the GCC that ships with the Android NDK, just like it does for Clang.  You can also target Linux – either remotely or locally with the Windows Subsystem for Linux – with GCC.

Compiler options for GCC.
Compiler options for GCC.

Check out our post on Visual C++ for Linux Development for much more info about how to use Visual Studio to target Linux with GCC.  If you are specifically interested in targeting WSL locally, check out Targeting WSL from Visual Studio.


Visual Studio also makes use of the Edison Design Group (EDG) frontend to provide flexible IntelliSense regardless of whether you use MSVC, Clang, or GCC to build your code.  Visual Studio gives you access to a wide range of choices when it comes to C++ compilers.  This way you can make sure that as you develop your code, it continues to compile against all major compilers.

Install Visual Studio today and give it a try.  Please let us know if we have missed any compilers you use, and share your feedback as we look forward to improving your C++ development experience.

Posted in C++


Discussion is closed.

Feedback usabilla icon