C++: LINK : debug\XXXXX.exe 未找到或不是由最后一个增量链接构建的;执行完整链接
使用Visual Studio 2008 SP1,
此行:
LINK : debug\XXXXX.exe not found or not built by the last incremental link; performing full link
每次编译项目时都会出现,无论我所做的更改有多么小。
原因可能是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
就我而言,我昨天遇到了这个错误。
VS设置
代码生成>运行时库
到多线程调试DLL (/MDd)
,而不是多线程调试(/MTd)
。如果我重新创建新项目,这种错误的设置会再次发生。我手动切换到
/Mtd
,然后没有发生错误。In my case, I have got this error yesterday.
VS set
code generation > runtime Library
toMulti-threaded Debug DLL (/MDd)
instead ofMulti-threaded Debug (/MTd)
.If i recreate new project this bad settings happens again. I manually switch to
/Mtd
, then no error happens.我正在运行一个批处理脚本,并让它在编译之前删除 exe,这样我就可以在编译后在运行 exe 之前检查编译后的 exe:
当然,使用
@REM
注释掉以下行:删除 exe 会起作用,但这甚至不是真正的解决方案:我发现绕过错误消息的一种方法:当您删除 .exe 时,您可以通过同时删除任何 .exe 来避免出现警告消息。 ilk,其中包含链接数据:
到目前为止,我发现的最佳解决方案是 禁用增量链接。 您可以通过在 cl 命令末尾添加
/link /INCRMENTAL:NO
来执行此操作,例如所以:I was running a batch script and having it delete the exe before compile, so I could then check for the compiled exe after compilation before running the exe:
Of course, using
@REM
to comment out the line that delete the exe would work, but that's not even really a solution:One way I found to get around the error message: when you delete the .exe, you can avoid the warning message by also deleting any .ilk, which contains the linking data:
So far, the best solution I've found is to disable incremental linking. You can do this by adding
/link /INCREMENTAL:NO
to the end of your cl command, like so:老问题,但以防万一对某人来说这仍然是一个问题(而且它是..)。
增量链接与生成清单文件不兼容(Proj opts > 链接器 > 清单文件 > 生成清单:是)。事实上,生成清单会修改 exe/dll,因此链接器必须进行完整链接。
有一些解决方法,有关更多详细信息:
http://chadaustin.me/2009/05/incremental-linking- and-embedded-manifests/
临时(也是最简单/最快)的解决方案是在开发过程中禁用清单生成,并在发布阶段再次启用它。尽管这会禁用应用程序的 XP/Vista 风格的 GUI(控件看起来像“经典模式”)。
Old question, but just in case for someone it is still an issue (and it is..).
Incremental link is incompatible with generating manifest file (Proj opts > Linker > Manifest File > Generate Manifest: Yes). Indeed, generating manifest modifies exe/dll so linker has to do full linkage.
There are some workarounds, for more details:
http://chadaustin.me/2009/05/incremental-linking-and-embedded-manifests/
Temporary (and easiest/fastest) solution is to disable manifest generation during development and enable it again in the release stage. Although this disables XP/Vista-style gui for the app (controls look like in "classic mode").
因此,如果我将
/INCRMENTAL
添加到链接器命令行,问题就会自行解决。尽管事实上根据文档的默认行为是启用增量链接。奇怪的。
So it turns out that the problem fixes it self if I add
/INCREMENTAL
to the linker command line. This in spite the fact that the default behavior according to the docs is to enable incremental linking.Strange.
真的是在黑暗中拍摄,但是,...
您是否将 XXXXX.exe 从构建的位置移动到其他地方?增量链接的全部目的是更改现有的 exe。如果没有,那就很困难了...
另一个可能的原因是文件在构建后被更改了(可能是由另一个工具)...
所有原因都列在 /INCRMENTAL 的帮助项目:
Really shooting in the dark but,...
Do you move the XXXXX.exe from where it is built to somewhere else? The whole point of an incremental link is to change an existing exe. If there is none, it will be difficult...
Another possible reason is that the file was changed after the build (probably by another tool)...
All the reasons are listed in the help item for /INCREMENTAL:
(也是在黑暗中)一个可能的原因是您使用了引用
__DATE__
宏的项目范围标头。但在这种情况下,您也会看到完整的重新编译(是吗?)(ALso in the dark) One possible reason is that you use a project-wide header referencing the
__DATE__
macro. But in that case, you'd see a full recompile as well (do you?)