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. Hexo+gitment

    Gitment是一个基于GitHub问题的评论系统,可以在没有任何服务器端实现的前端使用. 演示页面 中文简介 特征 入门 方法 定制 关于安全 特征 GitHub登录 Markdown / GFM支 ...

  2. webpack Error: Cannot find module 'webpack/lib/Chunk' Extract-text-webpack-plugin 分离CSS

    深入浅出webpack 1.5章节使用Extract-text-webpack-plugin分离css 安装插件后打包提示错误 Error: Cannot find module 'webpack/l ...

  3. SPP-net论文总结

    SPPNet方法来自<Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition> ,是大神 ...

  4. 梯度消失&&梯度爆炸

    转载自: https://blog.csdn.net/qq_25737169/article/details/78847691 前言 本文主要深入介绍深度学习中的梯度消失和梯度爆炸的问题以及解决方案. ...

  5. mysql优化建议21条

    转自: http://blog.csdn.net/waferleo/article/details/7179009 今 天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于 ...

  6. ES6的新特性(21)——Proxy

    Proxy 概述 Proxy 用于修改某些操作的默认行为,等同于在语言层面做出修改,所以属于一种“元编程”(meta programming),即对编程语言进行编程. Proxy 可以理解成,在目标对 ...

  7. .net web 应用程序C#

    简介 开发环境:VS2015 ASP.NET:可以开发出几乎所有运行在Windows上的应用程序:.NET是一种架构,一种新的API:引入程序集代替DLL: ADO.NET:一组.NET组件提供对数据 ...

  8. Python:字符串操作总结

    所有标准的序列操作(索引.分片.乘法.判断成员资格.求长度.取最小值最大值)对字符串同样适用,且字符串是不可变的. 一.字符串格式化 转换说明符 [注]: 这些项的顺序至关重要 (1)%字符:标记转换 ...

  9. 2018软工实践—Alpha冲刺(4)

    队名 火箭少男100 组长博客 林燊大哥 作业博客 Alpha 冲鸭鸭鸭鸭! 成员冲刺阶段情况 林燊(组长) 过去两天完成了哪些任务 协调各成员之间的工作 协助前后端接口的开发 测试项目运行的服务器环 ...

  10. TCP系列43—拥塞控制—6、Congestion Window Validation(CWV)

    一.概述 在RFC2861中,区分了TCP连接数据传输的三种状态   After sending a data segment:       If tcpnow - T_last >= RTO ...