/W switch

The /W switch specifies the warning level of the MIDL compiler. The warning level indicates the severity of the warning.

midl /W level

Switch Options


Specifies the warning level, an integer in the range 0 through 4. There is no space between the /W switch and the digit indicating the warning-level value.


Warning levels range from 1 to 4, with a value of zero meaning to display no warning information. The highest-severity warning is level 1. The following table describes the warnings for each warning level.

Warning levelDescriptionExample
W0No warnings.
W1Severe warnings that can cause application errors.No binding handle specified, unattributed pointers, conflicting switches.
W2May cause problems in the user's operating environment.Identifier length exceeds 31 characters. No default union arm specified.
W4Lowest warning level.Non-ANSI C constructs.


Warnings are different from errors. Errors cause the MIDL compiler to halt processing of the IDL file. Warnings cause the MIDL compiler to emit an informational message and continue processing the IDL file.

The warning level set by the /W switch can be used with the /WX switch to cause the MIDL compiler to halt processing of the IDL file.

The /W switch behaves the same as the /warn switch.


midl /W2 filename.idl

midl /W4 bar.idl

See also

General MIDL Command-line Syntax



Community Additions