尽管增加了链接,但当库发生更改时,Exe仍执行完整链接 [英] Exe performs full link when Library changes, despite incremental linking
问题描述
我有一个MSVC ++项目,由可执行文件,几个自己的静态库和一些预编译的静态第三方库组成.该exe使用增量链接以加快构建时间.
I have an MSVC++ project consisting of an executable, several own static libraries and some precompiled static third party libraries. The exe uses incremental linking in order to speed up build time.
当我在可执行项目中更改.cpp文件时,编译+链接的速度非常快(< 10s).
但是,当我在自己的一个库中更改.cpp文件时,可执行项目似乎正在对其使用的每个库进行 full 链接.
我现在不确定它是否是完整的链接,但是从"vc90.pdb not found"链接器警告中,我可以看出它链接到一些根本没有更改的外部库.
When I change a .cpp file within the executable project, compiling + linking is very quick (<10s).
However, when I change a .cpp file within one of my own libraries, the executable project appears to be doing a full link against every library it uses.
I'm not so sure anymore if it is a full link in fact, but from the "vc90.pdb not found" Linker Warnings, I can tell that it links against some external libraries which have not changed at all.
这是项目结构的示例:
- 预编译的第三方库
ExtLib1
,ExtLib2
和ExtLib3
- 使用第三方库
ExtLib1
的自己的库 - 使用
MyLib
和ExtLib1-3
自己的Exe
MyLib
MyExe
- Precompiled third party libraries
ExtLib1
,ExtLib2
andExtLib3
- Own Library
MyLib
, using third party libExtLib1
- Own Exe
MyExe
, usingMyLib
andExtLib1-3
在MyLib
中更改.cpp文件将导致MyExe
链接到MyLib
,ExtLib1
,ExtLib2
和ExtLib3
,即使 Incremental Linking 是打开.
Changing a .cpp file in MyLib
would then lead to MyExe
being linked to MyLib
, ExtLib1
, ExtLib2
and ExtLib3
, even if Incremental Linking is turned on.
在我的项目中,完整的链接大约需要5分钟,所以我问:是否有任何方法可以仅重新链接已更改的库?
A full link takes around 5 minutes in my project, so I'm asking: Is there any way to re-link only the changed library?
推荐答案
This is a introduction to incremental linking. It lists situations that will cause a full link. One of them is "An object that was compiled with the /Yu /Z7 option is changed.", check if your MyLib caught it.
这篇关于尽管增加了链接,但当库发生更改时,Exe仍执行完整链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!