Bug 2341

Summary: linker error If I use ACE_Utils::UUID
Product: ACE Reporter: sathya
Component: ACE CoreAssignee: sathya
Status: RESOLVED FIXED    
Severity: major    
Priority: P3    
Version: 5.4.2   
Hardware: x86   
OS: Windows XP   
Bug Depends on:    
Bug Blocks: 3253    

Description sathya 2005-12-22 01:55:09 CST
I have ACE-5.4.2 and I compiled and created the ACE static library

I wrote the following program and it has linker problem

#include <ace/UUID.h>

int main( int argc, char *argv[] ) {
    ACE_Utils::UUID au;
    ACE_Utils::UUID_Generator generator;
    generator.init();
    generator.generateUUID( au );
    return 0;
}

I compiled it using the MS VS .net 2003 and it is giving the following linker 
error:

Linking...
Main.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl 
ACE_OS::strlen(unsigned short const *)" (?strlen@ACE_OS@@YAIPBG@Z) referenced in 
function "public: __thiscall ACE_String_Base<unsigned short>::
ACE_String_Base<unsigned short>(unsigned short const *,class ACE_Allocator *,
int)" (??0?$ACE_String_Base@G@@QAE@PBGPAVACE_Allocator@@H@Z)
Main.obj : error LNK2019: unresolved external symbol "unsigned short * __cdecl 
ACE_OS::strsncpy(unsigned short *,unsigned short const *,unsigned int)" (?
strsncpy@ACE_OS@@YAPAGPAGPBGI@Z) referenced in function "public: unsigned short 
* __thiscall ACE_String_Base<unsigned short>::rep(void)const " (?rep@?
$ACE_String_Base@G@@QBEPAGXZ)
Main.obj : error LNK2019: unresolved external symbol "unsigned short * __cdecl 
ACE_OS::strnchr(unsigned short *,unsigned short,unsigned int)" (?
strnchr@ACE_OS@@YAPAGPAGGI@Z) referenced in function "public: int __thiscall 
ACE_String_Base<unsigned short>::find(unsigned short,unsigned int)const " (?
find@?$ACE_String_Base@G@@QBEHGI@Z)
Main.obj : error LNK2019: unresolved external symbol "unsigned short * __cdecl 
ACE_OS::strnstr(unsigned short *,unsigned short const *,unsigned int)" (?
strnstr@ACE_OS@@YAPAGPAGPBGI@Z) referenced in function "public: int __thiscall 
ACE_String_Base<unsigned short>::find(unsigned short const *,unsigned int)const 
" (?find@?$ACE_String_Base@G@@QBEHPBGI@Z)
Debug/NitroUtilStaticLinkingTest.exe : fatal error LNK1120: 4 unresolved 
externals

The content of the config.h file is as follows:

#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1

#ifdef ACE_AS_STATIC_LIBS
#define ACE_NO_INLINE
#endif


#include "ace/config-win32.h"
Comment 1 Johnny Willemsen 2005-12-23 07:25:21 CST
Please retest with x.4.8 we released recently. We have test for this class and
they link fine. Also, vc7 is known to be broken, please upgrade to vc7.1
Comment 2 sathya 2006-01-04 19:57:56 CST
Enabling the "wchar_t as built-in type" option in the C/C++->Language settings  
will fix the problem