visual-studiovisual-studio-2015edit-and-continue

How to ensure that the /EDITANDCONTINUE directive is not ignored


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

Solution

  • 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