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