C + + Compilation error Resolution

Source: Internet
Author: User
Tags vc9 visual studio 2002 visual studio 2010

Compile first to determine the compiler version

Msvc++ 11.0 _msc_ver = 1700 (Visual Studio 2012)
Msvc++ 10.0 _msc_ver = A (Visual Studio 2010)
Msvc++ 9.0 _msc_ver = (Visual Studio 2008)
msvc++ 8.0 _msc_ver = 1400 (Visual Studio 2005)
Msvc++ 7.1 _msc_ver = 1310 (Visual Studio 2003)
msvc++ 7.0 _msc_ver = 1300 (Visual Studio 2002)
Msvc++ 6.0 _msc_ver = 1200
msvc++ 5.0 _msc_ver = 1100

the criteria supported by the query compiler version :

Wiki: Currently the latest C + + standard is ISO/IEC 14,882:2017

Release time Document Referred Note
2017 ISO/IEC C++17
2014 ISO/IEC 14,882:2014 C++14 Fourth C + + standard
2011 ISO/IEC 14,882:2011 C++11 A third C + + standard
2007 ISO/IEC TR 19,768:2007 C + + TR1 C + + Technical report: library extensions
2006 ISO/IEC TR 18,015:2006 C + + Performance Technical Report
2003 ISO/IEC 14,882:2003 c++03 A second C + + standard
1998 ISO/IEC 14,882:1998 C++98 The first C + + standard

How to determine the compiler version in the program:

_msc_ver

Adding a _msc_ver macro to a program allows the compiler to selectively compile a program based on the compiler version. For example, one version of the compiler generated LIB files may not be another version

This compiler call, the Lib file generated by multiple versions of the compiler is placed in the LIB call library of the program when the application is developed. Adding _msc_ver macros to your program

, the compiler will be able to automatically select the version of the Lib library that can be linked, as shown below, at the time of invocation.

1 #if_msc_ver >= 1400//for Vc8, or VC92 #ifdef _DEBUG3 #pragmaComment (lib, "Somelib-vc8-d.lib")4 #elseIf5 #pragmaComment (lib, "Somelib-vc8-r.lib")6 #endif7 #elseIf _msc_ver >= 1310//For vc718 #ifdef _DEBUG9 #pragmaComment (lib, "Somelib-vc71-d.lib")Ten #elseIf One #pragmaComment (lib, "Somelib-vc71-r.lib") A #endif - #elseIf _msc_ver >=1200//For VC6 - #ifdef _DEBUG the #pragmaComment (lib, "Somelib-vc6-d.lib") - #elseIf - #pragmaComment (lib, "Somelib-vc6-r.lib") - #endif + #endif
Example:#if(_msc_ver = = 1300)//VC7#import"acax16enu.tlb"no_implementation raw_interfaces_only named_guids#elif(_msc_ver = = 1200)//VC6#import"acad.tlb"no_implementation raw_interfaces_only named_guids#elif(_msc_ver = = 1400)//Vc8#import"acax17enu.tlb"no_implementation raw_interfaces_only named_guids#elif(_msc_ver = = 1500)//VC9#import"acax18enu.tlb"no_implementation raw_interfaces_only named_guids#endif

Query Compiler Options

Compiler attributes

C + + Compilation error Resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.