LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
Asked Answered
H

7

55

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?

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

Hertfordshire answered 15/10, 2009 at 19:2 Comment(4)
Why is it a linker error? I believe you, I'm just inexperienced with C++ and visual studio. Switching from ZI (Program Database Edit and Continue) to Zi (Program Database) made these errors go away, but it might just be hiding the root problem. Could you elaborate?Hertfordshire
@Hertfordshire there's effectively three stages of compiling, (1) parsing - understanding what each cpp file says, (2) code generation - generating opcodes for each function file, and (3) linking - linking the opcodes for each function togeather. This warning begins with LNK, indicating it's a linker error.Dunagan
It's a nice touch that this still says "ignoring /EDITANDCONTINUE" when there's no "/EDITANDCONTINUE" option.Shoat
@GlennMaynard it's an internal Microsoft Visual Studio flag that gets enabled when other flags are used.Translunar
H
46

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.

Himeji answered 15/10, 2009 at 19:13 Comment(2)
Is there a specific flag I can pass? I've passed \Zi but still getting this warning.Icarian
It's /, not `\`. Also, make sure you picked it on the build (DEBUG or RELEASE) that you are trying to buildHimeji
S
30

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.

Serles answered 13/6, 2014 at 22:59 Comment(1)
You may need to do this for the project being linked to, not just the project that has the warning.Ballot
F
7

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:

References = Keep Unreferenced Data (/OPT:NOREF)

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

Fight answered 12/6, 2013 at 18:28 Comment(0)
P
1

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

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

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

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

Patrology answered 13/3, 2018 at 20:24 Comment(0)
O
0

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.

Bob.

Ondometer answered 15/10, 2009 at 19:20 Comment(1)
I had a lib compiled for release imported in debug project and the warning appeared. Something like this indeed.Aubreyaubrie
L
0

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.)

Leif answered 15/10, 2019 at 17:23 Comment(0)
A
0

You can also get this error if you've accidentally added a debug directory into your release build. Check Linker->General->Additional Library Directories. Worked for me.

Adrastus answered 4/4, 2021 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.