How to ensure that the /EDITANDCONTINUE directive is not ignored

南笙酒味 提交于 2019-12-01 20:19:10

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

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

/SAFESEH:NO

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

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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!