如何检测我是否使用Visual Studio 2008编译代码? [英] How to Detect if I'm Compiling Code With Visual Studio 2008?

查看:125
本文介绍了如何检测我是否使用Visual Studio 2008编译代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法知道我是否在Microsoft Visual Studio 2008下编译?

Is there any way to know if I'm compiling under Microsoft Visual Studio 2008 ?

推荐答案

_MSC_VER 是你需要的。您还可以在任何最近的boost安装中检查visualc.hpp的一些使用示例。

_MSC_VER is what you need. You can also examine visualc.hpp in any recent boost install for some usage examples.

更新版本的编译器的一些值是:

Some values for the more recent versions of the compiler are:

MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
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

上面的版本号是指您在Visual Studio中看到的主要版本,不到年的名字。有关详细列表,请访问此处

The version number above of course refers to the major version of your Visual studio you see in the about box, not to the year in the name. A thorough list can be found here.

cl.exe /?将给出使用版本的提示,例如:

cl.exe /? will give a hint of the used version, e.g.:

c:\program files (x86)\microsoft visual studio 11.0\vc\bin>cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x86
.....

这篇关于如何检测我是否使用Visual Studio 2008编译代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆