Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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!
Posted
Comments
Sergey Alexandrovich Kryukov 10-Apr-13 10:45am    
It's very hard to see what is screwed up without having the project. Did you try to clean? Remove all output and intermediate files?
—SA

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.
 
Share this answer
 
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 ).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900