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 3.6】如何将list存入txt后,再读出list

    今天遇到一个需求,就是将一个list文件读取后,存入一个txt配置文件.存入时,发现list文件无法直接存入,必须转为str模式. 但在读取txt时,就无法恢复成list类型来读取了(准确地说,即使强 ...

  2. 基于C#的机器学习--模糊逻辑-穿越障碍

    模糊逻辑-穿越障碍 模糊逻辑.另一个我们经常听到的术语.但它的真正含义是什么?它是否意味着不止一件事?我们马上就会知道答案. 我们将使用模糊逻辑来帮助引导一辆自动驾驶汽车绕过障碍,如果我们做得正确,我 ...

  3. #Ubuntu 18.04 安装tensorflow-gpu 1.9

    参考 https://tensorflow.google.cn/install/install_linux http://nvidia.com/cuda http://developer.nvidia ...

  4. eos TODO EOS区块链上EOSJS和scatter开发dApp

    由于我一直在深入研究EOS dApp的开发,我看了不少好文章.在这里,我汇总了下做一些研究后得到的所有知识.在本文中,我将解释如何使用EOSJS和scatter.我假设你对智能合约以及如何在EOS区块 ...

  5. 【算法设计与数据结构】为何程序员喜欢将INF设置为0x3f3f3f3f?(转)

    摘自https://blog.csdn.net/jiange_zh/article/details/50198097 在算法竞赛中,我们常常需要用到一个“无穷大”的值,对于我来说,大多数时间我会根据具 ...

  6. ElasticSearch之CURL操作(有空再去整理)

    https://www.cnblogs.com/jing1617/p/8060421.html ElasticSearch之CURL操作 CURL的操作    curl是利用URL语法在命令行方式下工 ...

  7. Xftp安装和使用的视频录制方法

    内容: 1.使用工具 2.操作步骤及方法 视频地址: http://v.youku.com/v_show/id_XMzEwNjg2MTg2NA==.html?spm=a2h3j.8428770.341 ...

  8. 对懂球帝ios版的用户体验

    用户界面: 主页面是资讯页面 这个设计很棒 对球迷来说 每天最关注的就是 我的主队赢了输了 其次界面以绿色为主 很有绿茵场的感觉 很符合足球狗的口味 记住用户的选择: 这个应用 有一个 球队的关注 选 ...

  9. multipart/form-data post 方法提交表单,后台获取不到数据

    这个和servlet容器有关系,比如tomcat等. 1.get方式 get方式提交的话,表单项都保存在http header中,格式是 http://localhost:8080/hello.do? ...

  10. dRMT: Disaggregated Programmable Switching

    dRMT: Disaggregated Programmable Switching 2017年SIGCOMM会议上提出的新型可编程交换机架构,对2013年提出的RMT架构存在的问题进行了优化. 主要 ...