I'm not sure if this is a bug or a known incompatibility. I haven't
been able to find authoritative information via search engine. This
bit of info may provide some help to other wayward souls who are
running Visual C++ 2003 with the April 2005 SDK installed.
Microsoft C++ Compiler Version: 13.10.3077 for 80x86 (Visual Studio
..NET 2003)
Microsoft Incremental Linker Version: 7.10.3077 (Visual Studio .NET
2003)
Microsoft Platform SDK Version: 3790.1830 (April 2005)
In trying to compile some C++ code that uses an STL queue, I
encountered linker errors, which can be reproduced using the sample
code for queue.cpp in the Visual C++ help:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/vcstdlib/html/vcsampSamplequeuefunctionsSTLSample.htm
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vcoriStandardTemplateLibrarySamples.asp
When compiled as a Win32 Console Project under Release mode, the
program produces the following error messages:
queue.obj : error LNK2019: unresolved external symbol "public: void
__thiscall std::_String_base::_Xran(void)const "
(?_Xran@_String_base@std@@QBEXXZ) referenced in function "public: class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > & __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::erase(unsigned
int,unsigned int)"
(?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z)
queue.obj : error LNK2019: unresolved external symbol "public: void
__thiscall std::locale::facet::_Register(void)"
(?_Register@facet@locale@std@@QAEXXZ) referenced in function "class
std::num_put<char,class std::ostreambuf_iterator<char,struct
std::char_traits<char> > > const & __cdecl std::use_facet<class
std::num_put<char,class std::ostreambuf_iterator<char,struct
std::char_traits<char> > > >(class std::locale const &)"
(??$use_facet@V?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@@std@@YAABV?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@0@ABVlocale@0@@Z)
queue.obj : error LNK2019: unresolved external symbol "public: class
std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned
int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z) referenced in
function "class std::num_put<char,class
std::ostreambuf_iterator<char,struct std::char_traits<char> > > const &
__cdecl std::use_facet<class std::num_put<char,class
std::ostreambuf_iterator<char,struct std::char_traits<char> > > >(class
std::locale const &)"
(??$use_facet@V?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@@std@@YAABV?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@0@ABVlocale@0@@Z)
queue.obj : error LNK2019: unresolved external symbol "public: void
__thiscall std::_String_base::_Xlen(void)const "
(?_Xlen@_String_base@std@@QBEXXZ) referenced in function "protected:
bool __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned
int,bool)"
(?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)
The problem is caused by attempting to link against the version of
libcp.lib in the latest Microsoft Platform SDK.
After adding the linker option /VERBOSE:LIB to the build, one can see
that the linker is picking up the SDK version of the library just prior
to the linker error message:
Searching C:\Program Files\Microsoft Platform SDK\lib\libcp.lib
If you do a DUMPBIN /ALL for libcp.lib in the SDK versus the one the
ships with Visual C++ .NET 2003, you'll find that the symbols are
decorated differently. For example, in the the case of _Xran():
VC++7: ?_Xran@_String_base@std@@QBEXXZ (public: void __thiscall
std::_String_base::_Xran(void)const )
PSDK: ?_Xran@std@@YAXXZ (void __cdecl std::_Xran(void))
Additionally, If one removes the copy of libcp.lib from the platform
SDK directory so that the linker does not find it, the linker finds the
Visual C++ .NET 2003 version and completes successfully. The sample
program executes as expected.
--
P.J. Hinton
|