_MSC_VER

https://msdn.microsoft.com/en-us/library/vstudio/b0084kay.aspx

Evaluates to an integer literal that encodes the major and minor number components of the compiler‘s version number. The major number is the first component of the period-delimited version number and the minor number is the second component.

For example, if the version number of the Visual C++ compiler is 17.00.51106.1, the _MSC_VER macro evaluates to 1700. Type cl /? at the command line to view the compiler‘s version number.




http://zhidao.baidu.com/link?url=-3Tt0whWtZprWu2x8g2hCePEKiaKPpcROJ87Vlq6z9qUIfUhtwJGrbip57d0A8vSg2ROzTxgadMfstAHAkw5hK




http://blog.csdn.net/u012818231/article/details/16990661

vs版本与_MSC_VER的对应

同学问到一个问题,没有明白问题的原因。多方查找资料后,发现是程序使用的库与开发环境版本问题。

程序用vs2010编译时,出现错误。

[cpp] view plaincopy

  1. 错误  1   error C1189: #error :  "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. Newer versions are currently not supported."

打开此文件,部分代码如下:

[cpp] view plaincopy

  1. #if !defined _MSC_VER
  2. #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. To suppress this Error, uncomment this line."
  3. #else
  4. #if _MSC_VER < 1200
  5. // older then VC6, too old to use library.
  6. #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. Older compiler versions are not supported."
  7. #elif _MSC_VER == 1200
  8. // VC6
  9. #elif _MSC_VER == 1300
  10. // VC70 not supported
  11. #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. VC7.0 is not supported."
  12. #elif _MSC_VER == 1310
  13. // VC71
  14. #elif _MSC_VER == 1400
  15. // VC80
  16. #elif _MSC_VER == 1500
  17. // VC90
  18. #else
  19. #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. Newer versions are currently not supported."
  20. // other maybe newer compiler ...
  21. #endif
  22. #endif

然后,查了下_MSC_VER,原来是用来定义编译器的版本。

[cpp] view plaincopy

  1. MS VC++10.0 _MSC_VER=1600(VS2010)
  2. MS VC++9.0 _MSC_VER=1500(VS2008)
  3. MS VC++8.0 _MSC_VER=1400(VS2005)
  4. MS VC++7.0 _MSC_VER=1300
  5. MS VC++7.1 _MSC_VER=1310
  6. MS VC++6.0 _MSC_VER=1200

在程序中加入_MSC_VER宏可以根据编译器版本让编译器选择行的编译一段程序。例如一个版本编译器产生的lib文件可能不能被另一个版本的编译器调用,那么在开发应用程序的时候,在该程序的lib调用库中放入多个版本编译器产生的lib文件。[1]

此实例就是这个问题,文件中的代码:

[cpp] view plaincopy

  1. #if !defined UDSHL_LIB_NO_LINK
  2. #if (!defined _MSC_VER || _MSC_VER >= 1500)  // vc80 compiler, and other here
  3. #pragma warning( disable : 4996) // Disable deprecated warnings.
  4. #if defined _DEBUG
  5. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc9d.lib" )
  6. #else
  7. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc9.lib" )
  8. #endif
  9. #elif (!defined _MSC_VER || _MSC_VER >= 1400)    // vc80 compiler, and other here
  10. #pragma warning( disable : 4996) // Disable deprecated warnings.
  11. #if defined _DEBUG
  12. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc8d.lib" )
  13. #else
  14. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc8.lib" )
  15. #endif
  16. #elif (!defined _MSC_VER || _MSC_VER >= 1300)    // vc71 compiler, and other here
  17. #if defined _DEBUG
  18. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc71d.lib" )
  19. #else
  20. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc71.lib" )
  21. #endif
  22. #else
  23. #if defined _DEBUG
  24. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc6d.lib" )
  25. #else
  26. #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc6.lib" )
  27. #endif
  28. #endif

根据不同的版本选择对应的库(IAT_UDSHL07_vc**.lib)文件。还分为debug和release版。

问题是,如果我只安装了vs2010该怎么运行呢?

更改工程的属性->平台工具集,选择v90后,提示

[cpp] view plaincopy

  1. 错误  1   error MSB8010: 指定的平台工具集(v90)需要 Visual Studio 2008。请确保在计算机上安装 Visual Studio 2008。

[1]. _MSC_VER.http://baike.so.com/doc/515910.html

时间: 2024-08-05 22:57:47

_MSC_VER的相关文章

_MSC_VER详细介绍

_MSC_VER是微软公司推出的C/C++编译器在ANSI/ISO C99标准之外扩展的宏定义,用来定义当前微软公司自己的编译器的主版本. _MSC_VER可以分解为: MS:Microsoft的简写. C:MSC就是Microsoft的C编译器. VER:Version的简写. _MSC_VER的意思就是:Microsoft的C编译器的版本. MS VC++ 14.0 _MSC_VER = 1900 (Visual C++ 2015) MS VC++ 12.0 _MSC_VER = 1800

预定义宏__GNUC__和_MSC_VER

一.预定义__GNUC__宏 1 __GNUC__ 是gcc编译器编译代码时预定义的一个宏.需要针对gcc编写代码时, 可以使用该宏进行条件编译. 2 __GNUC__ 的值表示gcc的版本.需要针对gcc特定版本编写代码时,也可以使用该宏进行条件编译. 3 __GNUC__ 的类型是"int",该宏被扩展后, 得到的是整数字面值.可以通过仅预处理,查看宏扩展后的文本. 示例: #include <assert.h> #include <stdio.h> #in

预定义宏_GNUC_ _MSC_VER

一.预定义__GNUC__宏 1 __GNUC__ 是gcc编译器编译代码时预定义的一个宏.需要针对gcc编写代码时, 可以使用该宏进行条件编译. 2 __GNUC__ 的值表示gcc的版本.需要针对gcc特定版本编写代码时,也可以使用该宏进行条件编译. 3 __GNUC__ 的类型是“int”,该宏被扩展后, 得到的是整数字面值.可以通过仅预处理,查看宏扩展后的文本. 示例: #include <assert.h> #include <stdio.h> #include <

[转贴]VC编译器版本号_MSC_VER and _MSC_FULL_VER

Visual Studio version and discrimination macros Abbreviation Product name [Visual Studio version] ?1 VC ++ version ?2 _MSC_VER _MSC_FULL_VER 2017 Update 7 Visual Studio 2017 version 15.7.5 14.14 1914 191426433 2017 Update 7 Visual Studio 2017 version

QT5 获取mac地址和cpu序列号

1 #include <QCoreApplication> 2 #include <QStringList> 3 #include <QString> 4 #include <qdebug.h> 5 #include <QNetworkInterface> 6 7 #ifdef __GNUC__ 8 #include <cpuid.h> 9 #elif defined(_MSC_VER) 10 #if _MSC_VER >= 1

使用字符串输出图形效果

[cpp] view plaincopy ////////////////////////////////////////////////////////////////// // StringEffect - 字符串效果 // // Author:  木头云 // Blog:    http://blog.csdn.net/markl22222 // E-Mail:  [email protected] // Version: 1.0.1002.1308 ///////////////////

两种用于派生的Singleton模式(以TextureMgr为例)

Singleton,顾名思义,从字面上来理解就是单例模式,这是C++程序中 常用到的一种设计模式,特别是像文件管理器,纹理管理器这种整个软件 中只需要唯一的实例来管理所有资源时,这种模式的价值便得以体现. 下面来介绍两种用于派生管理的Singleton模式: 其中,第一种是Gof版本的Singleton, 其代码如下: //[Singleton_Gof.h] #pragma once template<typename T> class Singleton_Gof { protected: s

推荐一个优秀的c++源代码,TinyXml2

项目主页:http://grinninglizard.com/tinyxml2docs/index.html tinyxml2.h /* Original code by Lee Thomason (www.grinninglizard.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for an

windows7下cygwin+vs2013编译webkit源码

先下载源码和其他依赖,然后准备cygwin的环境,安装vs2013,最后编译即可.网上没有能直接用于最新版本源码编译的教程,所以我在编译过程中也遇到了很多坑.回过头来看,这些坑都是可以避免的,想要自己尝试编译的同学,可以根据本文快速的实现自己编译webkit(~除去下载文件的时间,15分钟准备环境,1小时编译完成). 下载最近源码 最近的下载版本和源码在这里: http://nightly.webkit.org/ 我使用的源码是这个版本built on 13 October 2014 and i