/W, /w - Set Warning Level (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This option controls the number of warning messages produced by the compiler. Warnings indicate potential problems, rather than actual coding errors, with statements that might not compile as you intend.

/W{0 | 1 | 2 | 3 | 4 | X | all}

A space between /W and 0, 1, 2, 3, 4, or X is optional. Compiler warning messages are any messages beginning with C4. The /W options affect only source files named on the command line; they do not apply to object files.

W1 warnings are the most serious, and W4 warnings are the least serious. The following table describes the warning-level options.

Warning LevelDescription
/wTurns off all warning messages. Use this option when you compile programs that deliberately include questionable statements.

The /w option applies to the remainder of the command line, or applies until the next occurrence of a /w option on the command line. /W and /W0 are the same as /w.

/W1Default. Displays severe warning messages.
/W2Displays an intermediate level of warning messages. Level 2 includes warnings such as the following:
  • Use of functions with no declared return type
  • Failure to put return statements in functions with non-void return types
  • Data conversions that would cause loss of data or precision
/W3Displays a less severe level of warning messages, including warnings about function calls that precede their function prototypes in the source code.
/W4Displays the least severe level of warning messages, including warnings about the use constructs and extended keywords that are not ANSI standard.
/WXTreats all warnings as errors. If there are any warning messages, the compiler generates an error message, and continues compilation.
/WallEnables all warnings, including warnings that are disabled by default.

The following code example shows how to enable all possible warning messages for source files Crunch.c and Print.c. Microsoft C/C++ provides a pragma to control warning messages.


See Also

Compiler Options

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.