C++ LNK4075:由于“/OPT:ICF”规范而忽略“/EDITANDCONTINUE”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1574367/
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-27 20:29:42  来源:igfitidea点击:

LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification

c++visual-studiodlllinkerlinker-warning

提问by Mark

I recently converted a multi-project Visual Studio solution to use .dlls instead of .libs for each of the projects. However, I now get a linker warning for each project as stated in the example. MSDN didn't serve to be all that helpful with this. Why is this and how can I solve it?

我最近转换了一个多项目 Visual Studio 解决方案,为每个项目使用 .dlls 而不是 .libs。但是,我现在收到每个项目的链接器警告,如示例中所述。MSDN 对此并没有太大帮助。为什么会这样,我该如何解决?

Warning 2 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification LudoCamera.obj

警告 2 警告 LNK4075:由于“/OPT:ICF”规范而忽略“/EDITANDCONTINUE” LudoCamera.obj

采纳答案by Lou Franco

You can either have "Edit and continue" support or optimizations. Usually, you put "Edit and continue" on debug builds, and optimizations on release builds.

您可以拥有“编辑并继续”支持或优化。通常,您将“编辑并继续”放在调试版本上,并在发布版本上进行优化。

Edit and continue allows you to change code while you are debugging and just keep the program running. It's not supported if the code also has to be optimized.

编辑并继续允许您在调试时更改代码并保持程序运行。如果还需要优化代码,则不支持。

回答by Richard

I had this problem too. I opened the Project Properties, and then clicked General in the C/C++ tab. There is an option that says 'Debug Information Format', which I changed to Program Database (/Zi), and I didn't get the warning anymore.

我也有这个问题。我打开了项目属性,然后在 C/C++ 选项卡中单击了常规。有一个选项显示“调试信息格式”,我将其更改为程序数据库 (/Zi),并且不再收到警告。

回答by Walle

I also got this warning when converting a VS2008 project from .lib to .dll and the workaround was to change the Linker/Optimization settings on the Debug Win32 configuration from Default to:

将 VS2008 项目从 .lib 转换为 .dll 时,我也收到此警告,解决方法是将调试 Win32 配置上的链接器/优化设置从默认更改为:

References = Keep Unreferenced Data (/OPT:NOREF)

引用 = 保留未引用的数据 (/OPT:NOREF)

Enable COMDAT Folding = Do Not Remove Redundant COMDATs (/OPT:NOICF)

启用 COMDAT 折叠 = 不删除冗余 COMDAT (/OPT:NOICF)

回答by Penny

you should set BOTH projects 'Debug Information Format' as 'Program Database(/Zi)'. Eg. If the warning is :

您应该将两个项目的“调试信息格式”设置为“程序数据库(/Zi)”。例如。如果警告是:

warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification D:\mypath\project1\project1.obj project2

警告 LNK4075:由于“/OPT:ICF”规范 D:\mypath\project1\project1.obj project2 而忽略“/EDITANDCONTINUE”

Then in BOTH project1 and projects's properties. Set them as:

然后在 BOTH project1 和项目的属性中。将它们设置为:

project properties->Configuration Properties->C/C++->General->Debug Information Format, set it as ‘Program Database(/Zi)';

project properties->Configuration Properties->C/C++->General->Debug Information Format,设置为'Program Database(/Zi)';

回答by ulatekh

We had to set "Generate Debug Info" to "Yes (/DEBUG)" under the project properties' Linker->Debugging pane. Not sure how that wasn't set for a debug build in the first place, or why that wouldn't be the default, but there you go. (VS2010, in case that's relevant.)

我们必须在项目属性的“链接器”->“调试”窗格下将“生成调试信息”设置为“是 (/DEBUG)”。不确定一开始是如何为调试版本设置的,或者为什么这不是默认设置,但是你去了。(VS2010,以防万一。)

回答by scope_creep

I know what it is, they dll are not release versions. I think the linker still thinks they are debug builds, which still have the debug edit and continue functionality used when debugging still turned on.

我知道它是什么,它们的 dll 不是发布版本。我认为链接器仍然认为它们是调试版本,当调试仍然打开时,它们仍然具有调试编辑和继续功能。

Bob.

鲍勃。