_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
同学问到一个问题,没有明白问题的原因。多方查找资料后,发现是程序使用的库与开发环境版本问题。
程序用vs2010编译时,出现错误。
- 错误 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."
打开此文件,部分代码如下:
- #if !defined _MSC_VER
- #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. To suppress this Error, uncomment this line."
- #else
- #if _MSC_VER < 1200
- // older then VC6, too old to use library.
- #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. Older compiler versions are not supported."
- #elif _MSC_VER == 1200
- // VC6
- #elif _MSC_VER == 1300
- // VC70 not supported
- #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. VC7.0 is not supported."
- #elif _MSC_VER == 1310
- // VC71
- #elif _MSC_VER == 1400
- // VC80
- #elif _MSC_VER == 1500
- // VC90
- #else
- #error "Wrong Compiler. This library does only run with Visual C++ 7.1 and Visual C++ 6. Newer versions are currently not supported."
- // other maybe newer compiler ...
- #endif
- #endif
然后,查了下_MSC_VER,原来是用来定义编译器的版本。
- MS VC++10.0 _MSC_VER=1600(VS2010)
- MS VC++9.0 _MSC_VER=1500(VS2008)
- MS VC++8.0 _MSC_VER=1400(VS2005)
- MS VC++7.0 _MSC_VER=1300
- MS VC++7.1 _MSC_VER=1310
- MS VC++6.0 _MSC_VER=1200
在程序中加入_MSC_VER宏可以根据编译器版本让编译器选择行的编译一段程序。例如一个版本编译器产生的lib文件可能不能被另一个版本的编译器调用,那么在开发应用程序的时候,在该程序的lib调用库中放入多个版本编译器产生的lib文件。[1]
此实例就是这个问题,文件中的代码:
- #if !defined UDSHL_LIB_NO_LINK
- #if (!defined _MSC_VER || _MSC_VER >= 1500) // vc80 compiler, and other here
- #pragma warning( disable : 4996) // Disable deprecated warnings.
- #if defined _DEBUG
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc9d.lib" )
- #else
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc9.lib" )
- #endif
- #elif (!defined _MSC_VER || _MSC_VER >= 1400) // vc80 compiler, and other here
- #pragma warning( disable : 4996) // Disable deprecated warnings.
- #if defined _DEBUG
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc8d.lib" )
- #else
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc8.lib" )
- #endif
- #elif (!defined _MSC_VER || _MSC_VER >= 1300) // vc71 compiler, and other here
- #if defined _DEBUG
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc71d.lib" )
- #else
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc71.lib" )
- #endif
- #else
- #if defined _DEBUG
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc6d.lib" )
- #else
- #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc6.lib" )
- #endif
- #endif
根据不同的版本选择对应的库(IAT_UDSHL07_vc**.lib)文件。还分为debug和release版。
问题是,如果我只安装了vs2010该怎么运行呢?
更改工程的属性->平台工具集,选择v90后,提示
- 错误 1 error MSB8010: 指定的平台工具集(v90)需要 Visual Studio 2008。请确保在计算机上安装 Visual Studio 2008。
[1]. _MSC_VER.http://baike.so.com/doc/515910.html
_MSC_VER的更多相关文章
- _MSC_VER详细介绍
_MSC_VER详细介绍 转自:http://www.cnblogs.com/braver/articles/2064817.html _MSC_VER是微软的预编译控制. _MSC_VER可以分解为 ...
- 预定义宏__GNUC__和_MSC_VER
一.预定义__GNUC__宏 1 __GNUC__ 是gcc编译器编译代码时预定义的一个宏.需要针对gcc编写代码时, 可以使用该宏进行条件编译. 2 __GNUC__ 的值表示gcc的版本.需要针对 ...
- 预定义宏_GNUC_ _MSC_VER
一.预定义__GNUC__宏 1 __GNUC__ 是gcc编译器编译代码时预定义的一个宏.需要针对gcc编写代码时, 可以使用该宏进行条件编译. 2 __GNUC__ 的值表示gcc的版本.需要针对 ...
- Virtual Studio C++ Version Macro - _MSC_VER
MSVC++ (Visual Studio ) MSVC++ (Visual Studio ) MSVC++ (Visual Studio ) MSVC++ (Visual Studio ) MSVC ...
- #if _MSC_VER > 1000 #pragma once #endif 含义
前提:MFC应用程序中,MainFrm 类头文件 MainFrm.h 中#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000解释 ...
- error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1600”不匹配值“1800”
_MSC_VER 定义编译器的版本.下面是一些编译器版本的_MSC_VER值:MS VC++ 10.0 _MSC_VER = 1600MS VC++ 9.0 _MSC_VER = 1500MS VC+ ...
- [转贴]VC编译器版本号_MSC_VER and _MSC_FULL_VER
Visual Studio version and discrimination macros Abbreviation Product name [Visual Studio version] †1 ...
- qt项目: error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1900”不匹配值“1800”
error LNK2038: 检测到“_MSC_VER”的不匹配项: 值“1900”不匹配值“1800” 该错误 网上通常的解释是: 原因:由于你使用了vs2012,相比较vs2010以及之前的vs ...
- #if _MSC_VER > 1000 #pragma once #endif
#if _MSC_VER > 1000 #pragma once #endif 解释: 这是微软的预编译控制. 在_MSC_VER较小时,它对一些东西的支持与新版不同 _MSC_VER分解如下: ...
随机推荐
- TPO-18 C2 Possible participation in a sociology project
TPO-18 C2 Possible participation in a sociology project 第 1 段 1.listen to a conversation between a s ...
- 英特尔® 实感™ 深度摄像头代码示例 – R200 摄像头数据流
英特尔开发人员专区原文地址 简介 该可下载代码示例展示了如何使用面向 Windows 的英特尔® 实感™ SDK* 捕捉和查看用 C#/XAML 编写的原始 R200 摄像头数据流. Visual S ...
- MYSQL存储过程调试过程
mysql不像oracle有plsqldevelper工具用来调试存储过程,所以有几种简单的方式追踪执行过程: 1.用一张临时表,记录调试过程: 2.直接在存储过程中,增加select xxx,在控 ...
- Spring学习(2):面向接口编程思想
一. 引言 Spring核心的IOC的实体用了面向接口编程思想,所以有必要了解下.简单来说的话,Spring就是一个轻量级的控制反转(IOC)和面向切面(AOP)的容器框架. 接口的定义的概念:泛指实 ...
- 阿里IPO法律咨询费达1580万美元 为Facebook六倍
据路透社报道,阿里巴巴集团周五在 IPO (首次公开招股)更新文件中披露,将向美国盛信律师事务所(Simpson Thacher)以及其他为 IPO 提供咨询服务的律师事务所支付 1580 万美元的法 ...
- ArrayList中ensureCapacity的使用与优化
对于ArrayLis中有一个方法ensureCapacity(int n),这个方法可以对ArrayList低层的数组进行扩容,显示的调用这个函数,如果参数大于低层数组长度的1.5倍,那么这个数组的容 ...
- wireshark解析https协议方法
本文仅介绍通过协商密钥的方式实现https解析的方法 wireshark支持pem
- vue之指令篇 ps简单的对比angular
这两天在开始vue的大型项目,发现和ng还是有许多不同,这里对比下两者的指令系统 难度系数:ng的指令难度大于vue:至少vue上暂时没发现@&=:require,compile,precom ...
- Python:集合操作总结
集合是一组无序排列的不重复元素集 [注]:集合的最大作用是对一个序列进行去重操作 一.集合的分类 在Python中集合分为两类,为可变集合(set)和不可变集合(frozenset).对于可变集合(s ...
- Alpha 冲刺(7/10)
队名 火箭少男100 组长博客 林燊大哥 作业博客 Alpha 冲鸭鸭鸭鸭鸭鸭鸭! 成员冲刺阶段情况 林燊(组长) 过去两天完成了哪些任务 协调各成员之间的工作 学习MSI.CUDA 试运行软件并调试 ...