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编译时,出现错误。

  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."

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

  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,原来是用来定义编译器的版本。

  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]

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

  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后,提示

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

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

_MSC_VER的更多相关文章

  1. _MSC_VER详细介绍

    _MSC_VER详细介绍 转自:http://www.cnblogs.com/braver/articles/2064817.html _MSC_VER是微软的预编译控制. _MSC_VER可以分解为 ...

  2. 预定义宏__GNUC__和_MSC_VER

    一.预定义__GNUC__宏 1 __GNUC__ 是gcc编译器编译代码时预定义的一个宏.需要针对gcc编写代码时, 可以使用该宏进行条件编译. 2 __GNUC__ 的值表示gcc的版本.需要针对 ...

  3. 预定义宏_GNUC_ _MSC_VER

    一.预定义__GNUC__宏 1 __GNUC__ 是gcc编译器编译代码时预定义的一个宏.需要针对gcc编写代码时, 可以使用该宏进行条件编译. 2 __GNUC__ 的值表示gcc的版本.需要针对 ...

  4. Virtual Studio C++ Version Macro - _MSC_VER

    MSVC++ (Visual Studio ) MSVC++ (Visual Studio ) MSVC++ (Visual Studio ) MSVC++ (Visual Studio ) MSVC ...

  5. #if _MSC_VER &gt; 1000 #pragma once #endif 含义

    前提:MFC应用程序中,MainFrm 类头文件 MainFrm.h 中#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000解释 ...

  6. error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1600”不匹配值“1800”

    _MSC_VER 定义编译器的版本.下面是一些编译器版本的_MSC_VER值:MS VC++ 10.0 _MSC_VER = 1600MS VC++ 9.0 _MSC_VER = 1500MS VC+ ...

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

    Visual Studio version and discrimination macros Abbreviation Product name [Visual Studio version] †1 ...

  8. qt项目: error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1900”不匹配值“1800”

    error LNK2038: 检测到“_MSC_VER”的不匹配项:  值“1900”不匹配值“1800” 该错误 网上通常的解释是: 原因:由于你使用了vs2012,相比较vs2010以及之前的vs ...

  9. #if _MSC_VER > 1000 #pragma once #endif

    #if _MSC_VER > 1000 #pragma once #endif 解释: 这是微软的预编译控制. 在_MSC_VER较小时,它对一些东西的支持与新版不同 _MSC_VER分解如下: ...

随机推荐

  1. python学习笔记01 --------------hello world 与变量。

    1.第一个程序: print('hello world') 输出结果: hello world 2.变量 2.1 变量的作用: 把程序运算的中间结果临时存到内存里,以备后面的代码继续调用. 2.2 变 ...

  2. mac安装pkg 一直“正在验证” 卡着

    今天换了新mac, 但是之前wireshark(抓包工具) 不能用了 ,要安装Xquartz. 下载之后一直卡着, 网上找了半天没有解决方法. 最后我重启一下就好了... 重启一下. 2. 15款ma ...

  3. 445. Cosine Similarity【LintCode java】

    Description Cosine similarity is a measure of similarity between two vectors of an inner product spa ...

  4. JAVA基础学习之路(十一)引用传递

    引用传递: 不同栈内存可以指向同一块堆内存,不同栈内存可以对一块堆内存进行修改 范例一: class Message { private int num = 10; public Message(in ...

  5. [寒假学习笔记](二)Python初学

    Python 学习 python的自学从几个月前断断续续地进行,想好好利用这个寒假,好好地学一学. 回顾 已学习:基本操作.函数 已有C++的一定基础,只要注意python中比较特殊的部分就行 进入正 ...

  6. MobSF 框架安装使用部署

    1.MobSF 简介 MobSF是Mobile Security Framework的缩写,这是一款智能化的开源移动应用(Android.IOS.Windows)测试框架,可以对应用进行动态.静态分析 ...

  7. Python常用模块之hashlib

    Python里面的hashlib模块提供了很多加密的算法,这里介绍一下hashlib的简单使用事例,用hashlib的md5算法加密数据 import hashlib hash = hashlib.m ...

  8. java 中的 i=i++

    记得大学刚开始学C语言时,老师就说:自增有两种形式,分别是i++和++i,i++表示的是先赋值后加1,++i是先加1后赋值,这样理解了很多年也没出现问题,直到遇到如下代码,我才怀疑我的理解是不是错了: ...

  9. HDU 5225 枚举

    题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5225 bc(中文):http://bestcoder.hdu.edu.cn/contests ...

  10. ORACLE公司传奇历史

    ORACLE公司传奇 ORACLE公司之起源 很难想象,ORACLE 公司的这一段传奇居然要从 IBM 公司开始. 1970年的6月,IBM 公司的研究员埃德加·考特 (Edgar Frank Cod ...