本文介绍了如何在 Microsoft C++ 构建工具中抑制 D9025 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft C++ 编译器和构建工具编译一个库.我的构建环境设置了编译标志/GL,但对于特定的库,我需要关闭该标志.我可以使用/GL- 这样做,但是我收到警告 D9025,它只是告诉我我正在覆盖以前的设置.我想抑制这个警告.但是命令行选项/wd 只分叉 Cxxx 错误和警告,而不是 Dxxx 警告.如何抑制 D9025 警告?

I am compiling a library with Microsoft C++ compiler and build tools. My build environment sets the compile flag /GL, but for a specific library I need to turn that flag off. I can do so with /GL-, but I get a warning D9025, which simply tells me I am overriding the previous setting.I want to suppress this warning. But the command line option /wd only forks for Cxxx errors and warnings, not Dxxx warnings. How do I suppress the D9025 warning?

推荐答案

您无法抑制 D9025,您必须修复它.命令行警告 D9025 表示您在 cl.exe 命令上有冲突的选项线.在你的情况下,你有这样的事情:

You cannot suppress D9025, you have to fix that. Command-line warning D9025 means you have conflicting options on cl.exe command line. In your case you have something like this:

cl ... /GL ... /GL- ...

编译器实际上使用了命令行上最后指定的选项,但是那个命令行非常混乱.

Compiler actually uses the option that is specified last on the command line, but that command line is very confusing.

在您的 .vcxproj 文件中,确保您为 WholeProgramOptimization 属性设置了正确的选项.您的配置部分可能如下所示:

In your .vcxproj file make sure you have set correct option for WholeProgramOptimization property. Your configuration section might look like this:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
  ...
  <WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>

这篇关于如何在 Microsoft C++ 构建工具中抑制 D9025 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-04 00:20