5

I get this message when I try to edit and continue in VSC15:

'file.cpp' in 'LIB.DLL' was not linked with Edit and Continue enabled. 
Ensure that /INCREMENTAL linking is enabled, and the /EDITANDCONTINUE directive is not ignored.

I've already ensured that /INCREMENTAL is enabled but can't figure out the second part.

Compiler command line:

/Yu"stdfx.h" /GS /analyze- /W3 /Gy /Zc:wchar_t /ZI /Gm- /Od /Fd".\Debug\vc140.pdb" /Zc:inline /fp:fast /D "x86" /D "WIN32" /D "_WINDOWS" /D "DEBUG" /D "_UNICODE" /D "UNICODE" /D "_WINDLL" /errorReport:none /WX- /Zc:forScope /RTC1 /GR /Gd /Oy- /MTd /Fa".\Debug\" /EHsc /Fo".\Debug\" /Fp".\Debug\LIB.pch"

Linker command line:

/OUT:".\Debug\LIB.dll" /MANIFEST:NO /NXCOMPAT /PDB:".\Debug\LIB.pdb" /DYNAMICBASE /DEF:"EXPORT.DEF" /IMPLIB:".\Debug\LIB.lib" /DLL /MACHINE:X86 /NODEFAULTLIB:"libc.lib" /OPT:REF /SAFESEH /INCREMENTAL /PGD:".\Debug\LIB.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:".\Debug\LIB.dll.intermediate.manifest" /MAP /OPT:ICF
Enigma
  • 1,247
  • 3
  • 20
  • 51
  • What about the first part? I mean: ***'file.cpp' in 'LIB.DLL' was not linked with Edit and Continue enabled.*** – drescherjm Apr 27 '16 at 15:06
  • Ah... I'm also not sure why that isn't the case or where to make that true. So far as I can tell there's no option in the linker settings/properties for this. There is only the global `Tools > Options > Edit and Continue` checkbox AFAIK. – Enigma Apr 27 '16 at 15:07
  • I assume these are files you created in your projects? – drescherjm Apr 27 '16 at 15:09
  • `LIB.DLL` is the project output and `file.cpp` is in that project. – Enigma Apr 27 '16 at 15:11
  • I am already doing that. The warning before this one said to do so. – Enigma Apr 27 '16 at 16:58

4 Answers4

7

Looking at the command lines:

Compiler command line: Edit and Continue isn't really compatible with /Gm-, it requires "Enable Minimal Rebuild" (/Gm).

Linker command line: /OPT:REF, /SAFESEH, /OPT:ICF are all incompatible with Edit and Continue and should cause LNK4075.

If you try a clean build of LIB.dll, you should see warnings such as:

1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification
1>ConsoleApplication1.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
Ramkumar
  • 461
  • 5
  • 9
2

Try turning off SAFESEH on the advanced page of the linker settings.

/SAFESEH:NO

criddell
  • 14,289
  • 9
  • 41
  • 45
  • Tried. I still get: `Severity Code Description Project File Line Suppression State Error 'file.cpp' in 'LIB.DLL' was not linked with Edit and Continue enabled. Ensure that /INCREMENTAL linking is enabled, and the /EDITANDCONTINUE directive is not ignored. Edit and Continue` – Enigma Jun 02 '16 at 15:02
1

The complete official answer for vs2015 case is here https://blogs.msdn.microsoft.com/vcblog/2016/07/01/c-edit-and-continue-in-visual-studio-2015-update-3/ Also it may be helpful to read this one https://blogs.msdn.microsoft.com/vcblog/2013/10/29/the-visual-c-linker-best-practices-developer-iteration/

As for my case I haven't seen any uncompatible flags in linking command line, and it turned out that

/LTCG

is turned on by default, so I had to turn it of manually with additional linker option in every project of my solution

/LTCG:OFF

vitaliy
  • 104
  • 1
  • 6
0

I had the same problem, did all steps described above but no luck.

I use VS2017.

Helped next: you have to specify /ZI for each specific *.cpp file in your project:

  • right click on the *.cpp file in the Solution Explorer
  • Properties > C/C++ > General > Debug Information Format = Program Database for Edit And Continue (/ZI)
JEX725
  • 61
  • 5