Use the _MSC_VER macro. To check if the compiler is VS2010 or higher:
#if _MSC_VER >= 1600
The following are the values ββfor different versions of VS:
- VS 2003 (VC7.1):
1310 - VS 2005 (VC8):
1400 - VS 2008 (VC9):
1500 - VS 2010 (VC10):
1600 - VS 2012 (VC11):
1700
source share