您的位置:首页 > 其它

通过宏判断VS编译版本以及系统平台

2013-11-19 14:58 423 查看


1编译器

_MSC_VER 定义编译器的版本。下面是一些编译器版本的_MSC_VER值(参见扩展阅读中的参考文献2的链接)

MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)

MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)

MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)

MSVC++ 9.0  _MSC_VER == 1500 (Visual Studio 2008)

MSVC++ 8.0  _MSC_VER == 1400 (Visual Studio 2005)

MSVC++ 7.1  _MSC_VER == 1310 (Visual Studio 2003)

MSVC++ 7.0  _MSC_VER == 1300

MSVC++ 6.0  _MSC_VER == 1200

MSVC++ 5.0  _MSC_VER == 1100


其中MS VC++ 10.0就是Visual C++ 2010,MS VC++ 9.0就是Visual C++ 2008,MS VC++ 8.0就是Visual C++ 2005。版本名称上的的对应关系参见扩展阅读中的参考文献1的链接.

//******************************************************************************
// Automated platform detection
//******************************************************************************

// _WIN32 is used by
// Visual C++
#ifdef _WIN32
#define __NT__
#endif

// Define __MAC__ platform indicator
#ifdef macintosh
#define __MAC__
#endif

// Define __OSX__ platform indicator
#ifdef __APPLE__
#define __OSX__
#endif

// Define __WIN16__ platform indicator
#ifdef _Windows_
#ifndef __NT__
#define __WIN16__
#endif
#endif

// Define Windows CE platform indicator
#ifdef WIN32_PLATFORM_HPCPRO
#define __WINCE__
#endif

#if (_WIN32_WCE == 300) // for Pocket PC
#define __POCKETPC__
#define __WINCE__
//#if (_WIN32_WCE == 211) // for Palm-size PC 2.11 (Wyvern)
//#if (_WIN32_WCE == 201) // for Palm-size PC 2.01 (Gryphon)
//#ifdef WIN32_PLATFORM_HPC2000 // for H/PC 2000 (Galileo)
#endif


转自:

http://baike.baidu.com/view/1276757.htm

http://stackoverflow.com/questions/70013/how-to-detect-if-im-compiling-code-with-visual-studio-2008
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: