zoukankan      html  css  js  c++  java
  • _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

    vs版本与_MSC_VER的对应

    同学问到一个问题,没有明白问题的原因。多方查找资料后,发现是程序使用的库与开发环境版本问题。

    程序用vs2010编译时,出现错误。

    [cpp] view plaincopy在CODE上查看代码片派生到我的代码片
     
    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."  

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

    [cpp] view plaincopy在CODE上查看代码片派生到我的代码片
     
    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,原来是用来定义编译器的版本。

    [cpp] view plaincopy在CODE上查看代码片派生到我的代码片
     
    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]

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

    [cpp] view plaincopy在CODE上查看代码片派生到我的代码片
     
    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.   
    5.         #if defined _DEBUG  
    6.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc9d.lib" )  
    7.         #else  
    8.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc9.lib" )  
    9.         #endif  
    10.     #elif (!defined _MSC_VER || _MSC_VER >= 1400)    // vc80 compiler, and other here  
    11.         #pragma warning( disable : 4996) // Disable deprecated warnings.  
    12.   
    13.         #if defined _DEBUG  
    14.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc8d.lib" )  
    15.         #else  
    16.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc8.lib" )  
    17.         #endif  
    18.     #elif (!defined _MSC_VER || _MSC_VER >= 1300)    // vc71 compiler, and other here  
    19.         #if defined _DEBUG  
    20.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc71d.lib" )  
    21.         #else  
    22.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc71.lib" )  
    23.         #endif  
    24.     #else  
    25.         #if defined _DEBUG  
    26.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc6d.lib" )  
    27.         #else  
    28.             #pragma comment ( lib, UDSHL_LIB_DIR "IAT_UDSHL07_vc6.lib" )  
    29.         #endif  
    30.     #endif  

    根据不同的版本选择对应的库(IAT_UDSHL07_vc**.lib)文件。还分为debug和release版。

    问题是,如果我只安装了vs2010该怎么运行呢?

    更改工程的属性->平台工具集,选择v90后,提示

    [cpp] view plaincopy在CODE上查看代码片派生到我的代码片
     
    1. 错误  1   error MSB8010: 指定的平台工具集(v90)需要 Visual Studio 2008。请确保在计算机上安装 Visual Studio 2008。  

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

  • 相关阅读:
    Spring Cloud Stream
    解决eclipse中git插件中的cannot open git-upload-pack问题
    Unsupported major.minor version 51.0解决办法
    git将本地仓库上传到远程仓库
    Ubuntu下如何安装与运行Redis
    git中进入带有空格的目录下的解决办法
    http://www.111cn.net/jsp/Jsp-Servlet/45158.htm
    MySQL 5.6 for Windows 解压缩版配置安装
    http://blog.csdn.net/congcong68/article/details/39252897
    http://jingyan.baidu.com/article/bad08e1ee14ae409c85121cf.html
  • 原文地址:https://www.cnblogs.com/zkwarrior/p/4873669.html
Copyright © 2011-2022 走看看