Diagnostics and Messages

Option Description
-w0,-w Displays error messages only. Both -w0 and -w display exactly the same messages.
-w1,-w2 Displays warnings and error messages. Both -w1 and -w2 display exactly the same messages.The compiler uses this level as the default.
-w3 Displays warnings and error messages. This option displays more warnings than do -w1 and -w2.
-w4 Displays remarks, warnings, and error messages.

Controlling the Severity of Diagnostics

You can control the severity of some of the diagnostics returned by the compiler. The compiler returns two types of diagnostics:

In the descriptions below, tag represents the number associated with the diagnostic. Multiple tags are permitted, separated by commas.

Option Description

-wdL1[,L2,...]

Disable the soft diagnostics that corresponds to L1 through LN.

-wrL1[,L2,...] Override the severity of the soft diagnostics corresponding to L1 through LN and make it a remark.
-wwL1[,L2,...] Override the severity of the soft diagnostics corresponding to L1 through LN and make it a warning.
-weL1[,L2,...] Override the severity of the soft diagnostics corresponding to L1 through LN and make it an error.

For example, the following command line disables soft diagnostic 68 during compilation of the file a.cpp:

The following command line changes the severity of soft diagnostics 68 and 152 to remarks during compilation of the file a.cpp.

Assume that you have a file x.cpp that contains the following line:

extern i;

If you compile this code with warnings enabled (the default), you will receive the following response from the compiler:

x.cpp(2): warning #9: nested comment is not allowed/* This is a comment. */
x.cpp(5): warning #260: explicit type is missing ("int" assumed)
extern i;

If you compile the code with the option -wd9 (to disable warning number 9), you will receive the following response from the compiler:

x.cpp(5): warning #260: explicit type is missing ("int" assumed)
extern i;