_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分解如下: ...
随机推荐
- 城市规模越大,工资、GDP、犯罪率越高:4.5星|《规模》
规模 信息浓度非常高的一本书.篇幅也不小,纸书有568页,致谢与注释只占7%. 全书讲各种复杂的东西中存在的普遍规律:哺乳动物体重每增加一倍,心率降低25%:城市人口每增加一倍,加油站只增加85%:城 ...
- Linux内核学习笔记(7)--完全公平调度(CFS)
一.完全公平调度算法 完全公平调度 CFS 的出发点基于一个简单的理念:进程调度的效果应该如同系统具备一个理想中的完美多任务处理器.在这种系统中,每个进程能够获得 1/n 的处理器时间(n 为可运行进 ...
- linux云主机小技巧
微信服务器安装 安装库 python 3.5环境下 pip安装web.py时 会报错 "no module named "utils" 等问题 更换命令为“pip ins ...
- python基础知识-01-编码输入输出变量
python其他知识目录 名词解释: 编辑器 ide 程序员 操作系统 ASCAII码 unicode utf-8 浅谈CPU.内存.硬盘之间的关系 操作系统及Python解释器工作原理讲解 关于编译 ...
- Scrum立会报告+燃尽图 03
此作业要求:[https://edu.cnblogs.com/campus/nenu/2018fall/homework/2190] 一.小组介绍 组长:王一可 组员:范靖旋,王硕,赵佳璐,范洪达,祁 ...
- Python学习之路7 - 生成器&迭代器
本章内容: 列表生成式 生成器 yield 迭代器 列表生成式 当我们要定义一个列表的时候,我们通常用这种方式a = [1,2,3],但是如果我们定义了一个比较长的列表的时候,手动定义列表就会比较麻烦 ...
- c# 加载图片 正在被占用问题
问题情境:图片文件加载到pdf中,程序没有退出,再次加载该图片文件,提示被占用. 解决办法: 1.加载文件会锁定该文件,fromfile方法会导致占用内存较大,不使用该方法. FileStream f ...
- oracle执行完shutdown immediate后登陆不上了怎么办
在sqlplus 里登录后使用shutdown immediate 关闭数据库后若没有使用startup重启数据库就退出窗口则会出现下一次重启sqlplus窗口时无法登录的现象,解决方法如下 一.启动 ...
- 软工网络15团队作业4-DAY7
每日例会 昨天的工作. 张陈东芳:sql连接的基本完成,尝试被其他类调用,未导入全部商品信息: 吴敏烽:基本完成商品信息的调用: 周汉麟:设定商品的调用规则: 林振斌:设计缓存区代码,用于存取最近浏览 ...
- week1词频统计
使用java完成对txt格式的英文短片进行字符提取及统计. package nenu.softWareProject; import java.io.*;import java.util.*; pub ...