This option directs LIB to treat warnings as errors.


No arguments are permitted. The switch is /wx only.


The general effect of this option is to arrange that occurrence of a warning is itself an error (LNK1218). Should a warning occur, the corresponding warning message is followed by the error message and by termination. The warning number becomes the exit code.


The /wx option is irrelevant for warnings that have been successfully registered to be ignored (as done with the /ignore option). If such a warning occurs while /wx is active, then there is no warning message, no error message and no termination.

Warning LNK4224 is a hard-coded exception. It warns against using an option that has become obsolete. The intention seems to be that this warning is important enough that it must be seen and /ignore therefore does not disable it. Yet it is not so severe that /wx should make an error of it. If warning LNK4224 occurs while /wx is active, then there is a warning message, but no error message and no termination.


For who knows what reason, this obviously convenient switch is apparently undocumented. A corresponding switch for the compiler, also /WX (necessarily in upper case), has long been documented. Microsoft even recommends that “for a new project, it may be best to use /WX in all compilations; resolving all warnings will ensure the fewest possible hard-to-find code defects.” Surely this argument would retain at least some merit when applied to linking?

Though the /wx switch may be undocumented, Microsoft does use it in the master makefile for the Windows DDK. Indeed, the switch is active by default, being skipped only if the user knows to define the macro BUILD_ALLOW_LINKER_WARNINGS (which the DDK documentation does not list among the Build Utility Macros).