C++ Visual Studio 错误 D8016:“/ZI”和“/O2”命令行选项不兼容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29336562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 21:10:54  来源:igfitidea点击:

Visual Studio error D8016: '/ZI' and '/O2' command-line options are incompatible

c++optimizationvisual-studio-2013

提问by Nathan Schmidt

Visual Studio error D8016: '/ZI' and '/O2' command-line options are incompatible

Visual Studio 错误 D8016:“/ZI”和“/O2”命令行选项不兼容

I'm using optimization for the first time with C++. When I 'build solution' I keep getting this error. In the property pages, I have configuration set to Release Under project/properties/c++/optimization I tried all the options except for disable. Under project/properties/c++/General I also tried all the options under 'Debug Information Format' (assume 'None' is a good choice?). I think it might have something to do with the linker settings, but still don't know what to do.

我第一次使用 C++ 进行优化。当我“构建解决方案”时,我不断收到此错误。在属性页中,我将配置设置为 Release Under project/properties/c++/optimization 我尝试了除禁用之外的所有选项。在 project/properties/c++/General 下,我还尝试了“调试信息格式”下的所有选项(假设“无”是一个不错的选择?)。我认为这可能与链接器设置有关,但仍然不知道该怎么做。

回答by Michael Burr

Go to the project's property page and change the value for:

转到项目的属性页面并更改以下值:

C/C++ | General | Debug Information Format

To something other than "Program Database for Edit and Continue (/ZI)"

除了“用于编辑和继续的程序数据库(/ZI)”之外的其他内容

For example, "Program Database (/Zi)" should work.

例如,“程序数据库 (/Zi)”应该可以工作。

回答by Ismail Elouafiq

After changing

改变后

C/C++ | General | Debug Information Format

to Program Database (/Zi)

Program Database (/Zi)

You might need to set the solution configurationsto Release.

您可能需要将 设置solution configurationsRelease

回答by Skynight

Verify that under Linker -> Debugging says Generate Debug Info -> No.

验证在 Linker -> Debugging 下显示 Generate Debug Info -> No。

I had this problem as well.

我也有这个问题。