What version of Visual Studio does VC9, VC10, VC11, etc. correspond to, and their meanings

1. _MSC_VER defines the version of the compiler

  • MS VC++ 15.0 _MSC_VER = 1910 (Visual Studio 2017)

  • MS VC++ 14.0 _MSC_VER = 1900 (Visual Studio 2015)

  • MS VC++ 12.0 _MSC_VER = 1800 (VisualStudio 2013)

  • MS VC++ 11.0 _MSC_VER = 1700 (VisualStudio 2012)

  • MS VC++ 10.0 _MSC_VER = 1600(VisualStudio 2010)

  • MS VC++ 9.0 _MSC_VER = 1500(VisualStudio 2008)

  • MS VC++ 8.0 _MSC_VER = 1400(VisualStudio 2005)

  • MS VC++ 7.1 _MSC_VER = 1310(VisualStudio 2003)

  • MS VC++ 7.0 _MSC_VER = 1300(VisualStudio .NET)

  • MS VC++ 6.0 _MSC_VER = 1200(VisualStudio 98)

  • MS VC++ 5.0 _MSC_VER = 1100(VisualStudio 97)

Simply put, the corresponding relationship between the vs release version and the vc version is as follows:

  • Visual Studio 6 : vc6

  • Visual Studio 2003 : vc7

  • Visual Studio 2005 : vc8

  • Visual Studio 2008 : vc9

  • Visual Studio 2010 : vc10

  • Visual Studio 2012 : vc11

  • Visual Studio 2013 : vc12

  • Visual Studio 2015 : vc14

  • Visual Studio 2017 : vc15

2. Examples

Adding the _MSC_VER macro to the program allows the compiler to selectively compile a program according to the compiler version. For example, the lib file generated by one version of the compiler may not be called by another version of the compiler, so when developing an application, put the lib files generated by multiple versions of the compiler in the lib calling library of the program. Add the _MSC_VER macro to the program , and the compiler can automatically select the lib library version that can be linked according to its version when calling, as shown below:

#if _MSC_VER >= 1400 // for vc8, or vc9
 
#ifdef _DEBUG
 
#pragma comment( lib, "SomeLib-vc8-d.lib" )
 
#elif
 
#pragma comment( lib, "SomeLib-vc8-r.lib" )
 
#endif
 
#elif _MSC_VER >= 1310 // for vc71
 
#ifdef _DEBUG
 
#pragma comment( lib, "SomeLib-vc71-d.lib" )
 
#elif
 
#pragma comment( lib, "SomeLib-vc71-r.lib" )
 
#endif
 
#elif _MSC_VER >=1200 // for vc6
 
#ifdef _DEBUG
 
#pragma comment( lib, "SomeLib-vc6-d.lib" )
 
#elif
 
#pragma comment( lib, "SomeLib-vc6-r.lib" )
 
#endif
 
#endif

Guess you like

Origin blog.csdn.net/qq_44918090/article/details/132103401