C++: LINK : debug\XXXXX.exe 未找到或不是由最后一个增量链接构建的;执行完整链接

发布于 2024-08-08 08:28:14 字数 210 浏览 7 评论 0 原文

使用Visual Studio 2008 SP1,
此行:

LINK : debug\XXXXX.exe not found or not built by the last incremental link; performing full link

每次编译项目时都会出现,无论我所做的更改有多么小。
原因可能是什么?

Using visual studio 2008 SP1,
This line:

LINK : debug\XXXXX.exe not found or not built by the last incremental link; performing full link

appears every single time I compile the project, no matter how small a change I make.
What could be the reasons for that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

ペ泪落弦音 2024-08-15 08:28:15

就我而言,我昨天遇到了这个错误。

VS设置代码生成>运行时库多线程调试DLL (/MDd),而不是多线程调试(/MTd)

如果我重新创建新项目,这种错误的设置会再次发生。我手动切换到 /Mtd ,然后没有发生错误。

In my case, I have got this error yesterday.

VS set code generation > runtime Library to Multi-threaded Debug DLL (/MDd) instead of Multi-threaded Debug (/MTd).

If i recreate new project this bad settings happens again. I manually switch to /Mtd, then no error happens.

嘴硬脾气大 2024-08-15 08:28:15

我正在运行一个批处理脚本,并让它在编译之前删除 exe,这样我就可以在编译后在运行 exe 之前检查编译后的 exe:

pushd build
del win32_handmade.exe
cl -FC -Zi ..\code\win32_handmade.cpp user32.lib Gdi32.lib
IF EXIST "win32_handmade.exe" call "../build/win32_handmade.exe"

当然,使用 @REM 注释掉以下行:删除 exe 会起作用,但这甚至不是真正的解决方案:

@REM del win32_handmade.exe

我发现绕过错误消息的一种方法:当您删除 .exe 时,您可以通过同时删除任何 .exe 来避免出现警告消息。 ilk,其中包含链接数据:

del win32_handmade.exe
del win32_handmade.ilk

到目前为止,我发现的最佳解决方案是 禁用增量链接。 您可以通过在 cl 命令末尾添加 /link /INCRMENTAL:NO 来执行此操作,例如所以:

cl -FC -Zi ..\code\win32_handmade.cpp user32.lib Gdi32.lib /link /INCREMENTAL: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:

pushd build
del win32_handmade.exe
cl -FC -Zi ..\code\win32_handmade.cpp user32.lib Gdi32.lib
IF EXIST "win32_handmade.exe" call "../build/win32_handmade.exe"

Of course, using @REM to comment out the line that delete the exe would work, but that's not even really a solution:

@REM del win32_handmade.exe

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:

del win32_handmade.exe
del win32_handmade.ilk

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:

cl -FC -Zi ..\code\win32_handmade.cpp user32.lib Gdi32.lib /link /INCREMENTAL:NO
与他有关 2024-08-15 08:28:14

老问题,但以防万一对某人来说这仍然是一个问题(而且它是..)。

增量链接与生成清单文件不兼容(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").

迷乱花海 2024-08-15 08:28:14

因此,如果我将 /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.

半寸时光 2024-08-15 08:28:14

真的是在黑暗中拍摄,但是,...

您是否将 XXXXX.exe 从构建的位置移动到其他地方?增量链接的全部目的是更改现有的 exe。如果没有,那就很困难了...

另一个可能的原因是文件在构建后被更改了(可能是由另一个工具)...

所有原因都列在 /INCRMENTAL 的帮助项目:

此外,LINK 还执行完整的
如果有以下任何一项,请链接
出现的情况:

增量状态 (.ilk) 文件是
丢失的。 (LINK 创建一个新的 .ilk 文件
为后续做准备
增量链接。)

没有写入权限
.ilk 文件。 (LINK 忽略 .ilk 文件
并以非增量方式链接。)

.exe 或 .dll 输出文件是
失踪了。

.ilk、.exe 或
.dll 已更改。

LINK 选项已更改。大多数链接
选项,当在构建之间更改时,
导致完整链接。

添加了对象 (.obj) 文件或
省略。

使用以下方法编译的对象
/Yu /Z7 选项已更改。

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:

Additionally, LINK performs a full
link if any of the following
situations occur:

The incremental status (.ilk) file is
missing. (LINK creates a new .ilk file
in preparation for subsequent
incremental linking.)

There is no write permission for the
.ilk file. (LINK ignores the .ilk file
and links nonincrementally.)

The .exe or .dll output file is
missing.

The timestamp of the .ilk, .exe, or
.dll is changed.

A LINK option is changed. Most LINK
options, when changed between builds,
cause a full link.

An object (.obj) file is added or
omitted.

An object that was compiled with the
/Yu /Z7 option is changed.

烂柯人 2024-08-15 08:28:14
  1. 从 Microsoft 下载 procmon
  2. 运行它,设置一个过滤器,以便您查找对包含您的 .exe 名称的路径的访问。
  3. 做个链接吧
  4. 看看它遇到了什么问题——它是否找到它,是否在打开它时记录了错误。 Procmon 将记录每个文件的打开、读取、关闭等。如果出现错误,它将记录它。
  5. 还要确保它可以找到 .ilk 文件——我认为它也需要这个。
  1. Download procmon from Microsoft.
  2. Run it, set up a filter so that you are looking for accesses to the path that contains your .exe name.
  3. Do a link.
  4. See what trouble it's having -- does it find it, does it log an error on opening it. Procmon will log every single file open, read, close, etc. If it gets an error, it will log it.
  5. Also make sure it can find the .ilk file -- I think it needs that as well.
彩扇题诗 2024-08-15 08:28:14

(也是在黑暗中)一个可能的原因是您使用了引用 __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?)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文