/WX(将链接器警告视为错误)/WX (Treat Linker Warnings as Errors)

/WX[:NO]

备注Remarks

/WX 导致在链接器生成警告时不生成任何输出文件。/WX causes no output file to be generated if the linker generates a warning.

此选项类似于适用于 /wx for 编译器的选项。This option is similar to /WX for the compiler. 有关详细信息,请参阅 /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX(警告级别)For more information, see /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning Level). 但是,为编译指定 /wx 并不意味着 /wx 也将对链接阶段有效;必须为每个工具明确指定 /wxHowever, 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.

默认情况下, /wx 不起作用。By default, /WX is not in effect. 若要将链接器警告视为错误,请指定 /wxTo treat linker warnings as errors, specify /WX. /Wx: NO 与不指定 /wx 相同。/WX:NO is the same as not specifying /WX.

在 Visual Studio 开发环境中设置此链接器选项To set this linker option in the Visual Studio development environment

  1. 打开项目的“属性页” 对话框。Open the project's Property Pages dialog box. 有关详细信息,请参阅在 Visual Studio 中设置 C++ 编译器和生成属性For details, see Set C++ compiler and build properties in Visual Studio.

  2. 选择“配置属性” > “链接器” > “命令行”属性页 。Select the Configuration Properties > Linker > Command Line property page.

  3. 在 " 附加选项 " 框中输入选项。Enter the option into the Additional Options box.

以编程方式设置此链接器选项To set this linker option programmatically

  1. 请参阅 AdditionalOptionsSee AdditionalOptions.

另请参阅See also

MSVC 链接器参考MSVC linker reference
MSVC 链接器选项MSVC Linker Options