Using Visual Studio 10 C++, I'm having weird link error. For some reason references to a global object won't link to that global object. It is telling me a symbol is undefined yet when I have it view the .cod file the symbol is right there plain as day.
The error:
FTShell.lib(ftcommodule.obj) : error LNK2001: unresolved external symbol
"class CFTModuleShellBase * _pFTModule" (?_pFTModule@@3PAVCFTModuleShellBase@@A)
But the .cod file for the main cpp file shows both the declaration and allocation of the global symbol:
PUBLIC ?_pFTModule@@3PAVCFTModuleShellBase@@A ; _pFTModule
_DATA SEGMENT
?_pFTModule@@3PAVCFTModuleShellBase@@A DD FLAT:?_Module@@3VCFTComModule@@A ; _pFTModule
ORG $+4
So why wouldn't the static library's _pFTModule be matching the global symbol in my source file?
EDIT: I ran msbuild from the command line:
Link:
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exe
/ERRORREPORT:QUEUE.... "C:\(path)\FTTrace.res"
"C:\(path)\FTTrace.obj"
And I noticed at the end there is only one .obj file. There are two .cpp files in the project. And MSBUILD did build both file. So why didn't it pass both files on to the linker. The .vcxproj file doesn't treat the .cpp files differently. Why would MSBUILD not include both files on the link step?
<ItemGroup>
<ClCompile Include="FTTrace.cpp" />
<ClCompile Include="TraceImpl.cpp" />
</ItemGroup>