当我尝试在 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.
我已经确保
/INCREMENTAL
已启用,但无法弄清楚第二部分。编译器命令行:
/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"
链接器命令行:
/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
最佳答案
查看命令行:
编译器命令行: 编辑并继续与/Gm- 并不真正兼容,它需要“启用最小重建”(/Gm)。
链接器命令行:/OPT:REF、/SAFESEH、/OPT:ICF 都与“编辑并继续”不兼容,应该会导致 LNK4075。
如果您尝试全新构建 LIB.dll,您应该会看到如下警告:
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification
1>ConsoleApplication1.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
关于visual-studio - 如何确保/EDITANDCONTINUE 指令不被忽略,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36893621/