Ide-visual Studio vc\vs2005\vs2008\vs2010 Eliminate, ignore, and reinforce warnings warning

Source: Internet
Author: User
Tags studio vc

Compiler: Warning CXXXX

VC #pragma warning Directive This directive allows selective modification of the compiler's warning message behavior
The instruction format is as follows:
#pragma warning (warning-specifier:warning-number-list [; Warning-specifier:warning-number-list ...]
#pragma warning (push[, n])
#pragma warning (POP)
The main warnings are shown in the following sections:

Once: Show only one time (warning/error, etc.) message
Default: Resets the compiler's warning behavior to the defaults state
1,2,3,4: Four levels of warning
Disable: Suppresses the specified warning message
Error: Use the specified warning information as a bug report

If you do not understand the above explanation, please refer to the following examples and instructions

#pragma warning (disable:4507; once:4385; error:164)
Equivalent to:
#pragma warning (disable:4507 34)//Do not display 4507 and 34th warning messages
#pragma warning (once:4385)//No. 4385 warning information is reported only once
#pragma warning (error:164)//Put the 164th warning message as an error.
This pragma warning also supports the following formats:
#pragma warning (push [, N])
#pragma warning (POP)
Here n represents a warning level (1---4).
#pragma warning (push) to save an existing warning state for all warning messages.
#pragma warning (push, N) holds the existing warning state for all warning messages, and the global warning
The level is set to N.
#pragma warning (pop) pops the last warning message to the stack, which is made between the stack and the stack.
All changes are canceled. For example:
#pragma warning (push)
#pragma warning (disable:4705)
#pragma warning (disable:4706)
#pragma warning (disable:4707)
#pragma warning (POP)

At the end of this code, re-Save all warning messages (including 4705,4706 and 4707)

When programming with standard C + +, you often get a lot of warning messages, which are unnecessary hints,
So we can use #pragma warning (disable:4786) to suppress this type of warning

The use of ADO in the VC will also get unnecessary warning message, this time we can through

#pragma warning (disable:4146) to eliminate this type of warning message


Connector: Warning LNKXXXX


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.