Hi all.<br/> <br/> We face the problem that we see some very rare linker errors "unresolved externals" during our automated builds.<br/> Long story short is that one static lib is not resolved for one of dozens of projects once in a while.<br/> See the details below. <br/> <br/> Environment:<br/> Visual Studio Professional 2005 SP1<br/> ####<br/> Microsoft Visual Studio 2005<br/> Version 8.0.50727.762 (SP.050727-7600)<br/> * Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601) <br/> * Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB971090)<br/> ####<br/> <br/> * 318 Projects in one SLN<br/> <br/> Problem:<br/> The solution - among all the other things - builds a common static lib for some of the projects and sometimes for one of the projects we will get unresolved external linker errors for the exported symbols of this static lib. <br/> This happened twice during the last 2 Weeks. That would be 2 times for about ~ 100 automated builds for all development branches.<br/> The error happened in two independent development branches.<br/> <br/> + The project dependencies in the .sln File are set correctly.<br/> + The generated command line as shown in the GUI correctly displays the library.<br/> + Building the SLN a second time after the error will "just work"<br/> <br/> Logging Output:<br/> ####<br/> Solution C:...xyz.sln<br/> Running C
rogrammeMicrosoft Visual Studio 8Common7IDEdevenv.com with parameters : /build "Release|Win32" "C:...xyz.sln"<br/> ------<br/> Microsoft (R) Visual Studio Version 8.0.50727.762.<br/> Copyright (C) Microsoft Corp 1984-2005. All rights reserved.<br/> 1>------ Build started: Project: P001, Configuration: Release Win32 ---<br/> 2>------ Build started: Project: P002, Configuration: Release Win32 ---<br/> 3>------ Build started: Project: P003, Configuration: Release Win32 ---<br/> 4>------ Build started: Project: P004, Configuration: Release Win32 ---<br/> 3>Compiling...<br/> 4>Compiling...<br/> 2>Performing Custom Build Step<br/> (....)<br/> 22>------ Build started: Project: CD_Driver, Configuration: Release Win3<br/> (...)<br/> 22>CommonDriver.cpp<br/> (...)<br/> 22>CDriver.cpp<br/> (...)<br/> 22>ErrorTools.cpp<br/> 22>Generating Code...<br/> (...)<br/> 22>Creating library...<br/> 18>a.cpp<br/> 18>b.cpp<br/> 22>Build log was saved at "file://c:...CD_DriverReleaseBuildLog.htm"<br/> 22>CD_Driver - 0 error(s), 0 warning(s)<br/> (....)<br/> 264>------ Build started: Project: CDHM13, Configuration: Release Win32<br/> 265>------ Build started: Project: P265, Configuration: Release Win32 <br/> 264>Compiling...<br/> 265>Compiling...<br/> 262>Linking...<br/> (....)<br/> 264>HoribaMDLT1300.obj : error LNK2019: unresolved external symbol "public: void __thiscall CCDriver::LogString(int,char const *)" (?LogString@CCDriver@@QAEXHPBD@Z) referenced in function "private: int __thiscall CHoribaMDLT1300::InitDeviceLAN(void)" (?InitDeviceLAN@CHoribaMDLT1300@@AAEHXZ)<br/> (.... more LNK2019 ....)<br/> 264>HoribaMDLT1300.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall CCDriver::ResetErrorCodes(void)" (?ResetErrorCodes@CCDriver@@MAEXXZ)<br/> (.... more LNK2001 ....)<br/> 264>.....Release/CDHM13.dll : fatal error LNK1120: 69 unresolved externals<br/> 264>Build log was saved at "file://c:.....ReleaseBuildLog.htm"<br/> 264>CDHM13 - 71 error(s), 0 warning(s)<br/> 267>Compiling...<br/> (....)<br/> ========== Build: 312 succeeded, 1 failed, 0 up-to-date, 0 skipped ===<br/> devenv.com returned Error code : 1<br/> ####<br/> <br/> The other time this happened in exactly the same manner for another project in another build two weeks earlier, where it was project build number 78.<br/> <br/> The linker commandline as shown in the GUI for these projects:<br/> (78)<br/> /OUT:".....Release/CDH900G.dll" /INCREMENTAL:NO /NOLOGO <br/> /LIBPATH:"C
rogrammeboost_library-1_34_1vc8libs" /DLL /MANIFEST <br/> /MANIFESTFILE:".ReleaseCDH900G.dll.intermediate.manifest" /DEBUG <br/> /PDB:".....Release/CDH900G.pdb" /SUBSYSTEM:WINDOWS /BASE:"0x49600000"<br/> /IMPLIB:".....Release/CDH900G.lib" /MACHINE:X86 /ERRORREPORT
ROMPT<br/> winmm.lib "....releasettools.lib" "....releasetdm.lib" "....releasecd_driver.lib"<br/> <br/> (264)<br/> /OUT:".....Release/CDHM13.dll" /INCREMENTAL:NO /NOLOGO <br/> /LIBPATH:"C
rogrammeboost_library-1_34_1vc8libs" /DLL /MANIFEST <br/> /MANIFESTFILE:".ReleaseCDHM13.dll.intermediate.manifest" /DEBUG <br/> /PDB:".....Release/CDHM13.pdb" /SUBSYSTEM:WINDOWS /BASE:"0x43000000" <br/> /IMPLIB:".....Release/CDHM13.lib" /MACHINE:X86 /ERRORREPORT
ROMPT <br/> Mpr.lib winmm.lib "....releasettools.lib" "....releasetdm.lib" "....releasecd_driver.lib"<br/> <br/> As can be seen, the GUI tells me that the cd_driver.lib is correctly referenced.<br/> <br/> <br/> So ... anyone got any idea, why Visual Studio 2005 would rarely ignore linker dependencies and just spit out unresolved externals instead of linking the library?<br/> <br/> <br/> Note: I have found some references on the net that there are problems when there are transitive dependencies (ProjA > ProjB > ProjC) with MSBuild, but this is not the case here. Were not using MSBuild and the dependency is direct.<br/> <br/> cheers,<br/> Martin<br/>
View the full article





View the full article