[antlr-interest] Linker errors linking antlr 2.7.7 to product library using vc6

Neeraj Joshi jneeraj at us.ibm.com
Sat Jun 23 14:51:05 PDT 2007


Hi All,
I compiled antlr 2.7.7 using vc6 without any trouble, however I am running 
into linker errors while linking the generated antlr.lib with my product 
code. In one of the older posts I found a reference advising to use /MTd
flag while compiling. But that doesn't seem to help.
Any help is greatly appreciated!
Thanks in advance
Neeraj

ps.

(I have deleted some error messages to shorten the size of the email)

C:\neeraj\policy\workspace\pegasus\src\Providers\ManagedSystem\PolicyProvider>make



link -nologo -dll -debug 
-out:C:/neeraj/policy/workspace/pegasus/pegasus-exec/bin/PolicyProvider.dll 
-implib:C:/neeraj/policy/workspace/pegasus/pegasus-exec/lib/PolicyProvider.lib 

msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::~basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> >(void)" 
(??1?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at XZ) 
already defined in antlr.lib(CharScanner.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> >(char const *,class 
std::allocator<char> const &)" 
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at PBDABV?$allocator at D@1@@Z) 
already defined in antlr.lib(CharScanner.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class 
std::basic_ostream<char,struct std::char_traits<char> > & __thiscall 
std::basic_ostream<char,struct std::char_traits<char> >::operator<<(class 
std::basic_ostream<char,struct std::char_traits<char> > & (__cdecl*)(class 
std::basic_ostream<char,struct std::char_traits<char> > &))" 
(??6?$basic_ostream at DU?$char_traits at D@std@@@std@@QAEAAV01 at P6AAAV01@AAV01@@Z at Z) 
already defined in antlr.lib(CharScanner.obj)


msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "bool __cdecl 
std::operator==(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &,class 
std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> > const &)" 
(??8std@@YA_NABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@0 at 0@Z) 
already defined in antlr.lib(CommonAST.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> >(class 
std::allocator<char> const &)" 
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at ABV?$allocator at D@1@@Z) 
already defined in antlr.lib(CharScanner.obj)
libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall 
std::ios_base::Init::Init(void)" (??0Init at ios_base@std@@QAE at XZ) already 
defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall 
std::ios_base::Init::~Init(void)" (??1Init at ios_base@std@@QAE at XZ) already 
defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: class 
std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned 
int,bool)const " (?_Getfacet at locale@std@@QBEPBVfacet at 12@I_N at Z) already 
defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: bool __thiscall 
std::locale::_Iscloc(void)const " (?_Iscloc at locale@std@@QBE_NXZ) already 
defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall 
std::runtime_error::runtime_error(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(??0runtime_error at std@@QAE at ABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@1@@Z) 
already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: virtual __thiscall 
std::runtime_error::~runtime_error(void)" (??1runtime_error at std@@UAE at XZ) 
already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: virtual char const * 
__thiscall std::runtime_error::what(void)const " 
(?what at runtime_error@std@@UBEPBDXZ) already defined in 
msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "protected: virtual void 
__thiscall std::runtime_error::_Doraise(void)const " 
(?_Doraise at runtime_error@std@@MBEXXZ) already defined in 
msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall 
std::runtime_error::runtime_error(class std::runtime_error const &)" 
(??0runtime_error at std@@QAE at ABV01@@Z) already defined in 
msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall 
std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo at std@@QAE at PBD@Z) 
already defined in msvcprtd.lib(MSVCP60D.dll)

LIBCMTD.lib(dbgheap.obj) : error LNK2005: __malloc_dbg already defined in 
MSVCRTD.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in 
MSVCRTD.lib(MSVCRTD.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __free_dbg already defined in 
MSVCRTD.lib(MSVCRTD.dll)
LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in 
MSVCRTD.lib(MSVCRTD.dll)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in 
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in 
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in 
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in 
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(lconv.obj) : error LNK2005: _localeconv already defined in 
MSVCRTD.lib(MSVCRTD.dll)
LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in 
MSVCRTD.lib(MSVCRTD.dll)
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __stricmp already defined in 
LIBCMTD.lib(stricmp.obj)

msvcprtd.lib(MSVCP60D.dll) : warning LNK4006: "public: char const & 
__thiscall std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::operator[](unsigned int)const " 
(??A?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEABDI at Z) 
already defined in antlr.lib(CharScanner.obj); second definition ignored
msvcprtd.lib(MSVCP60D.dll) : warning LNK4006: "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> >::operator=(class 
std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> > const &)" 
(??4?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at ABV01@@Z) 
already defined in antlr.lib(CharScanner.obj); second definition ignored
msvcprtd.lib(MSVCP60D.dll) : warning LNK4006: "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> >::operator=(char const 
*)" 
(??4?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at PBD@Z) 
already defined in antlr.lib(CharScanner.obj); second definition ignored

msvcprtd.lib(MSVCP60D.dll) : warning LNK4006: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> >(class 
std::allocator<char> const &)" 
(??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at ABV?$allocator at D@1@@Z) 
already defined in antlr.lib(CharScanner.obj); second definition ignored
libcpmtd.lib(iostream.obj) : warning LNK4006: "public: __thiscall 
std::ios_base::Init::Init(void)" (??0Init at ios_base@std@@QAE at XZ) already 
defined in msvcprtd.lib(MSVCP60D.dll); second definition ignored
libcpmtd.lib(iostream.obj) : warning LNK4006: "public: __thiscall 
std::ios_base::Init::~Init(void)" (??1Init at ios_base@std@@QAE at XZ) already 
defined in msvcprtd.lib(MSVCP60D.dll); second definition ignored
libcpmtd.lib(locale0.obj) : warning LNK4006: "public: class 
std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned 
int,bool)const " (?_Getfacet at locale@std@@QBEPBVfacet at 12@I_N at Z) already 
defined in msvcprtd.lib(MSVCP60D.dll); second definition ignored

libcpmtd.lib(ios.obj) : warning LNK4006: "protected: virtual void 
__thiscall std::runtime_error::_Doraise(void)const " 
(?_Doraise at runtime_error@std@@MBEXXZ) already defined in 
msvcprtd.lib(MSVCP60D.dll); second definition ignored
libcpmtd.lib(ios.obj) : warning LNK4006: "public: virtual __thiscall 
std::runtime_error::~runtime_error(void)" (??1runtime_error at std@@UAE at XZ) 
already defined in msvcprtd.lib(MSVCP60D.dll); second definition ignored
libcpmtd.lib(ios.obj) : warning LNK4006: "public: __thiscall 
std::runtime_error::runtime_error(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(??0runtime_error at std@@QAE at ABV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@1@@Z) 
already defined in msvcprtd.lib(MSVCP60D.dll); second definition ignored

LIBCMTD.lib(crt0init.obj) : warning LNK4006: ___xi_a already defined in 
MSVCRTD.lib(cinitexe.obj); second definition ignored
LIBCMTD.lib(lconv.obj) : warning LNK4006: _localeconv already defined in 
MSVCRTD.lib(MSVCRTD.dll); second definition ignored
LIBCMTD.lib(getenv.obj) : warning LNK4006: _getenv already defined in 
MSVCRTD.lib(MSVCRTD.dll); second definition ignored
MSVCRTD.lib(MSVCRTD.dll) : warning LNK4006: __stricmp already defined in 
LIBCMTD.lib(stricmp.obj); second definition ignored
   Creating library 
C:/neeraj/policy/workspace/pegasus/pegasus-exec/lib/PolicyProvider.lib and 
object 
C:/neeraj/policy/workspace/pegasus/pegasus-exec/lib/PolicyProvider.exp
LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other 
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other 
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other 
libs; use /NODEFAULTLIB:library
ExpressionFactory.obj : error LNK2001: unresolved external symbol "public: 
virtual class Pegasus::String const __thiscall 
Pegasus::LogicalAnd::toString(void)const " 
(?toString at LogicalAnd@Pegasus@@UBE?BVString at 2@XZ)
LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
C:/neeraj/policy/workspace/pegasus/pegasus-exec/bin/PolicyProvider.dll : 
fatal error LNK1120: 2 unresolved externals
make: *** 
[C:/neeraj/policy/workspace/pegasus/pegasus-exec/lib/PolicyProvider.lib] 
Error 1120

C:\neeraj\policy\workspace\pegasus\src\Providers\ManagedSystem\PolicyProvider>






















































































































~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"'In the end, everything is fine. If it is not, it is not the end" 
Neeraj Joshi
Staff Software Engineer
Autonomic Computing Division
(919)543-5298
TIE: 441-5298
Ext: 3-5298
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070623/340b5487/attachment.html 


More information about the antlr-interest mailing list