在Visual Studio 2012中重建时出现奇怪的链接错误

在Visual Studio 2012中重建时出现奇怪的链接错误

问题描述:

我有一个非常奇怪的问题。我在VS2012中有一个项目,它与另一个lib静态链接。如果我建立项目一切都很好。但是,如果我重新启动项目,它将失败并出现链接问题。 lib是编译的,我在构建期间不编译它。如果我清理所有内容或在之前的构建之上构建/重建,则没有区别。构建作品,重建 - 不是!



清洁+构建 - >工作。

清洁+重建 - >没有。



任何人都可以给我至少一个线索 - 这两个命令有什么不同?我甚至都不知道如何开始调查这个问题。



这是一个例子:



1&gt ; C:\Program Files(x86)\ Microsoft Visual Studio 11.0\VC\include\sal.h(2872):警告RC4005:''_ useHeader'':重新定义1>

1> C:\Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ include \sal.h(2882):警告RC4005:''_ on_failure'':重新定义1>

1>创建库D:\p4client \ ProAudio\dev_main \ ProAudio \XPlatform..\VisualStudioBuildProducts \WaveShell-DAE \Win32 \Debug \Products\WaveShell-DAE.lib和对象D:\\ \\ p4client \ ProAudio\dev_main\ProAudio \XPlatform..\VisualStudioBuildProducts\WaveShell-DAE \Win32 \Debug \Products\WaveShell-DAE.exp 1> DefaultSwap.obj:错误LNK2019:未解决函数_RemoveByteSwapper中引用的外部符号_ASI_UnregisterCustomByteSwapper @ 4> DefaultSwap.obj:错误LNK2019:函数_RegisterByteSwapper 1中引用的未解析的外部符号_ASI_RegisterCustomByteSwapper @ 8> PlugInLib.lib(PlugInUtils.obj):错误LNK2001:未解析的外部符号_imp_FicGestalt @ 8 1> PlugInLib.lib(CDSPProcess.obj):错误LNK2001:未解析的外部符号_imp_FicGestalt @ 8 1> PlugInLib.lib(CAdaptorPlugIn.obj):错误LNK2001:未解析的外部符号_imp_FicGestalt @ 8 1> CShellProcessGro up.obj:错误LNK2019:未解析的外部符号_imp_FicGestalt @ 8在函数public:__thiscall CShellProcessGroup :: CShellProcessGroup(void)中引用(?? 0CShellProcessGroup @@ QAE @XZ)1> CEffectTypeRTAS.obj:错误LNK2001:未解析的外部符号_imp_FicGestalt @ 8 1> PlugInLib.lib(CProcessGroupInterface.obj):错误LNK2001:未解析的外部符号_imp_FicGestalt @ 8 1> PlugInLib.lib(CProcessGroup.obj):错误LNK2001:未解析的外部符号_imp_FicGestalt @ 8



也许有助于知道在运行Build(Not rebuild)时我会收到以下警告:



1> C: \Program Files(x86)\ Microsoft Visual Studio 11.0\VC \include\sal.h(2872):警告RC4005:''_ useHeader'':重新定义1>

1> C:\Program Files(x86)\ Microsoft Visual Studio 11.0\VC\include\sal.h(2882):警告RC4005:''_ on_failure'':重新定义1>

1 GT;创建库D:\p4client \ ProAudio\dev_main \ ProAudio \XPlatform..\VisualStudioBuildProducts \WaveShell-DAE \Win32 \Debug \Products\WaveShell-DAE.lib和对象D:\\ \\ p4client \ ProAudio\dev_main\ProAudio \XPlatform..\VisualStudioBuildProducts\WaveShell-DAE \Win32 \Debug \Products\WaveShell-DAE.exp 1> PlugInLib.lib(C321ChipDSP.obj) :警告LNK4099:未找到PDB''vc110_ib_2.pdb''与''PlugInLib.lib(C321ChipDSP.obj)''或''D:\ p4client \ ProAudio\dev_main \ ProAudio \ VisisStudioBuildProducts \\ \\WaveShell-DAE\Win32\Debug\vc110_ib_2.pdb '';链接对象,好像没有调试信息1> PlugInLib.lib(CDSP.obj):警告LNK4099:PDB''vc110_ib_3.pdb''未找到''PlugInLib.lib(CDSP.obj)''或''D :\p4client\ProAudio\dev_main\ProAudio\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\vc110_ib_3.pdb '';链接对象,好像没有调试信息1> PlugInLib.lib(CDSPUtils.obj):警告LNK4099:PDB''vc110_ib_4.pdb''未找到''PlugInLib.lib(CDSPUtils.obj)''或''D :\p4client\ProAudio\dev_main\ProAudio\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\vc110_ib_4.pdb '';链接对象好像没有调试信息



谢谢!

I have a very strange problem. I have a project in VS2012 that links statically with another lib. If I build project everything is fine. However, if I REBUILD the project it will fail with link problems. The lib is compiled, I do not compile it during the build. It is no difference if I clean everything or building/rebuilding on top of previous build. Build works, Rebuild - not!

Clean + Build -> Work.
Clean + Rebuild -> No.

Can anyone give me at least a clue - what different in those 2 commands? I do not even know how to start investigate the problem.

Here is the example:

1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\sal.h(2872): warning RC4005: ''_useHeader'' : redefinition 1>
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\sal.h(2882): warning RC4005: ''_on_failure'' : redefinition 1>
1> Creating library D:\p4client\ProAudio\dev_main\ProAudio\XPlatform..\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\Products\WaveShell-DAE.lib and object D:\p4client\ProAudio\dev_main\ProAudio\XPlatform..\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\Products\WaveShell-DAE.exp 1>DefaultSwap.obj : error LNK2019: unresolved external symbol _ASI_UnregisterCustomByteSwapper@4 referenced in function _RemoveByteSwapper 1>DefaultSwap.obj : error LNK2019: unresolved external symbol _ASI_RegisterCustomByteSwapper@8 referenced in function _RegisterByteSwapper 1>PlugInLib.lib(PlugInUtils.obj) : error LNK2001: unresolved external symbol _imp_FicGestalt@8 1>PlugInLib.lib(CDSPProcess.obj) : error LNK2001: unresolved external symbol _imp_FicGestalt@8 1>PlugInLib.lib(CAdaptorPlugIn.obj) : error LNK2001: unresolved external symbol _imp_FicGestalt@8 1>CShellProcessGroup.obj : error LNK2019: unresolved external symbol _imp_FicGestalt@8 referenced in function "public: __thiscall CShellProcessGroup::CShellProcessGroup(void)" (??0CShellProcessGroup@@QAE@XZ) 1>CEffectTypeRTAS.obj : error LNK2001: unresolved external symbol _imp_FicGestalt@8 1>PlugInLib.lib(CProcessGroupInterface.obj) : error LNK2001: unresolved external symbol _imp_FicGestalt@8 1>PlugInLib.lib(CProcessGroup.obj) : error LNK2001: unresolved external symbol _imp_FicGestalt@8

Maybe it will help to know that while running Build (Not rebuild) I will get the following warnings:

1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\sal.h(2872): warning RC4005: ''_useHeader'' : redefinition 1>
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\sal.h(2882): warning RC4005: ''_on_failure'' : redefinition 1>
1> Creating library D:\p4client\ProAudio\dev_main\ProAudio\XPlatform..\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\Products\WaveShell-DAE.lib and object D:\p4client\ProAudio\dev_main\ProAudio\XPlatform..\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\Products\WaveShell-DAE.exp 1>PlugInLib.lib(C321ChipDSP.obj) : warning LNK4099: PDB ''vc110_ib_2.pdb'' was not found with ''PlugInLib.lib(C321ChipDSP.obj)'' or at ''D:\p4client\ProAudio\dev_main\ProAudio\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\vc110_ib_2.pdb''; linking object as if no debug info 1>PlugInLib.lib(CDSP.obj) : warning LNK4099: PDB ''vc110_ib_3.pdb'' was not found with ''PlugInLib.lib(CDSP.obj)'' or at ''D:\p4client\ProAudio\dev_main\ProAudio\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\vc110_ib_3.pdb''; linking object as if no debug info 1>PlugInLib.lib(CDSPUtils.obj) : warning LNK4099: PDB ''vc110_ib_4.pdb'' was not found with ''PlugInLib.lib(CDSPUtils.obj)'' or at ''D:\p4client\ProAudio\dev_main\ProAudio\VisualStudioBuildProducts\WaveShell-DAE\Win32\Debug\vc110_ib_4.pdb''; linking object as if no debug info

Thanks!

我看到这个问题又回到了在VS2003附近的某个地方。即使您正确设置了所有项目设置和依赖项,重建选项也无法按预期工作。如果我的内存服务(使用VS2005),那么项目就会异步清理和构建,以便在完全删除/构建其依赖目标之前构建一组已删除的目标。我记录了具体行为,但信息在前雇主处丢失。我不记得这是否仍然是VS2010的问题(我每天使用它;我避免了这个问题),我还没有完全探索VS2012。
I have seen this problem going back to somewhere around VS2003. It seems that even if you have all project settings and dependencies setup correctly, the ''rebuild'' choice does not work as intended. If my memory serves (with VS2005), it did the project cleans and builds asynchronously such that one set of deleted targets was being built before its dependent targets were completely deleted/built. I documented the specific behavior but the info is "lost" at a previous employer. I don''t recall if this is still a problem with VS2010 (which I use daily; I avoid the problem), and I haven''t fully explored VS2012 yet.


我知道有两个可能的原因。



1.项目中有两个同名的源文件。链接成功或失败然后变为链接顺序依赖,这可能导致你看到的。



2. Visual Studio从未真正处理过NTFS时序粒度问题在执行并行构建和链接时检测其自己的中间文件中的更改。自2005年以来,每个版本的Visual Studio都出现了这些错误,这对于这一点来说是个混乱(增量链接在高端多核系统上自杀)。
I know of two possible reasons for this.

1. You have two source files in the project with the same name. Link success or failure then becomes link order dependent which can lead to what you see.

2. Visual Studio has never really dealt with the NTFS timing granularity issues when it comes to detecting changes in its own intermediate files when doing parallel builds and links. These bugs have got rarer with each version of Visual Studio since 2005 which was something of a mess with regard to this ( Incremental linking was suicide on high end multi-core systems ).