Warning
This page is located in archive.

Common values of MSVC version for C++ compilers

( wiki and blog ):

  • MSVC++ 5.0: _MSC_VER == 1100
  • MSVC++ 6.0: _MSC_VER == 1200
  • MSVC++ 7.0: _MSC_VER == 1300
  • MSVC++ 7.1: _MSC_VER == 1310 (Visual Studio 2003)
  • MSVC++ 8.0: _MSC_VER == 1400 (Visual Studio 2005)
  • MSVC++ 9.0: _MSC_VER == 1500 (Visual Studio 2008 - v90)
  • MSVC++ 10.0: _MSC_VER == 1600 (Visual Studio 2010 - v100)
  • MSVC++ 11.0: _MSC_VER == 1700 (Visual Studio 2012 - v110)
  • MSVC++ 12.0: _MSC_VER == 1800 (Visual Studio 2013 - v120)
  • MSVC++ 14.0: _MSC_VER == 1900 (Visual Studio 2015 - v140)
  • MSVC++ 14.1 - 14.16: _MSC_VER == 1910 - 1916 (Visual Studio 2017 - v141)
  • MSVC++ 14.2 - 14.27: _MSC_VER == 1920 - 1927 (Visual Studio 2019 - v142)

You should be able to make use of something like #ifdef _MSC_VER and #if _MSC_VER > 1400 or whatever your specific needs are.

Note: The value of _MSC_VER (equal to the installation directory VC\Tools\MSVC\xxx) differs from all other reported version numbers, such as the Visual Studio year or the Visual Studio version, that can be seen inside the Help / About Microsoft Visual Studio box. It even differs from the version, reported by the cl.exe compiler. A thorough list of predefined macros in many compilers is available.

For example - on my installation:

  • About box: Microsoft Visual Studio Enterprise 2017, Version 15.9.24
  • Project Properties / General / Platform Toolset: Visual Studio 2017 (v141)
  • cl.exe: Compilator version 19.16.27041
  • installed in MSVC\14.16.27023 directory
  • (macro) _MSC_VER == 1910
courses/cg/links/msvc_versions.txt · Last modified: 2023/09/19 21:40 (external edit)