1

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!

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.

Supplemental:

To all the people that answered - You are trying to explain me the difference between the build and rebuild. Thank you, but I know it. You ignore the fact that I explained before:

I can completely clean previous results, delete OutDir, delete IntDir, delete everything produced by the compilation. still - Build work, Rebuild not.

In the explained above case - what is the difference between build and rebuild if you build the first time??

The reason I did not posted errors is that those are simply link errors telling me .lib is missing. While it is clearly not.

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!

Iron-Eagle
  • 1,707
  • 2
  • 17
  • 34
  • Can you exit your question to include the errors a rebuild reports please? – simonc Apr 09 '13 at 14:32
  • For your specific issue, please post errors you are getting. As it stands, you question seems to be "What is the difference between Build and Rebuild?" which can be answered [here](http://stackoverflow.com/questions/3095901/difference-between-build-solution-rebuild-solution-and-clean-solution-in-visua) – quandrei Apr 09 '13 at 14:45

4 Answers4

1

Build means compile and link only the source files that have changed since the last build, while Rebuild means compile and link all source files regardless of whether they changed or not.

Build is the normal thing to do and is faster. Sometimes the versions of project target components can get out of sync and rebuild is necessary to make the build successful. In practice, you never need to Clean.

Leo Chapiro
  • 13,678
  • 8
  • 61
  • 92
0

'Build' will do an incremental build, basically going through each project in your solution, see if there has been a change since the last build, and if there is, build it again.

'Rebuild' will perform a clean on everything and build everything from scratch.

Edit: A more detailed answer link

Community
  • 1
  • 1
quandrei
  • 204
  • 1
  • 3
  • 10
0

If your static lib is another project in the same solution as the project that links to the lib, then you need to set a dependency between the two projects so that the build process will build the lib first and the other project second.

To do this, right-click on the Solution abd choose "Project dependencies" from the pop-up menu.

Roger Rowland
  • 25,885
  • 11
  • 72
  • 113
0

I am not sure if it is related. But you may want to check this thread (the symptom is reversed from yours though...):

VS2010 Unresolved External Symbol errors on build (but not rebuild)

nikoniko
  • 833
  • 2
  • 11
  • 22