description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||
---|---|---|---|---|---|---|---|---|---|
Learn more about: /WX (Treat linker warnings as errors) |
/WX (Treat linker warnings as errors) |
02/02/2023 |
|
|
e4ba97c7-93f7-43ae-a4bb-d866790926c9 |
Specifies whether to treat linker warnings as errors.
/WX
[:NO
]
/WX
[:
nnnn
[,
nnnn
...]]
The /WX
linker option causes no output file to be generated if the linker generates a warning.
This option is similar to /WX
for the compiler. For more information, see /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning Level). However, specifying /WX
for the compilation doesn't imply that /WX
will also be in effect for the link phase; you must explicitly specify /WX
for each tool.
In Visual Studio 2022 and later versions, you can specify /WX
with one or more comma-separated nnnn
arguments, where nnnn
is a number between 4000 and 4999. The linker treats the corresponding LNKnnnn
warnings as errors.
By default, /WX
isn't in effect. To treat linker warnings as errors, specify a /WX
option. /WX:NO
is the same as not specifying /WX
, and overrides any previous /WX
linker option.
-
Open the project's Property Pages dialog box. For more information, see Set compiler and build properties.
-
To set or unset all warnings as errors, select the Configuration Properties > Linker > General property page.
-
Modify the Treat Linker Warnings as Errors property.
-
To set specific warnings as errors, select the Configuration Properties > Linker > Command Line property page.
-
In the Additional Options edit control, add
/WX:warnings
, wherewarnings
is a comma-separated list of linker warning numbers. -
Choose OK or Apply to save your changes.
- See xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A.
MSVC linker reference
MSVC linker options
/WX
compiler option