[antlr-interest] Getting linker errors while building the ANTLR generated sources.
Arik Ter-Galstyan
arik_tg at yahoo.com
Mon Sep 22 22:48:32 PDT 2008
Markus and Jim thanks a lot for response.
Jim,
it's not me trying to link the LIBCMT.lib with antlr.lib but the VS2008 on it's own tries to link them together. I think that the ANTLR generated source files contain some function which refer to both libs. When I'm trying to exclude one of the conflicting libs from linking process then I get an "Unresolved external symbol" type of link error. Also, please tell me how can I change the project to use MSVCRT ?
Markus,
I had posted only the part of the linker errors in my previous email. There
were another linker errors explicitly pointing the conflict between msvcprt.lib and ANTLR.lib asshown below
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: int __thiscall std::ios_base::width(void)const " (?width at ios_base@std@@QBEHXZ) already defined in antlr.lib(CharScanner.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags at ios_base@std@@QBEHXZ) already defined in antlr.lib(CharBuffer.obj)
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good at ios_base@std@@QBE_NXZ) already defined in antlr.lib(CharBuffer.obj)
And I would like to repeat one more time that it is not me trying to link LIBCMT.lib and msvcrt.lib together. I have just created a Win32 Console application project and imported the ANTLR generated source code into the project assuming that it should build successfully, however it failed.
--- On Mon, 9/22/08, Jim Idle <jimi at temporal-wave.com> wrote:
> From: Jim Idle <jimi at temporal-wave.com>
> Subject: Re: [antlr-interest] Getting linker errors while building the ANTLR generated sources.
> To: arik_tg at yahoo.com
> Cc: antlr-interest at antlr.org
> Date: Monday, September 22, 2008, 9:55 AM
> On Mon, 2008-09-22 at 06:58 -0700, Arik Ter-Galstyan wrote:
>
> > Getting the following linker errors while building the
> ANTLR generated Lexer and Parser sources with Visual Studio
> 2008. Target language is C++.
> > In other words the antlr.lib conflicts with MS VS 2008
> native libraries due to repeated definition of functions in
> both libraries.
> >
> > Any ideas ???
> >
> > >LIBCMT.lib(setlocal.obj) : error LNK2005:
> __configthreadlocale already defined in
> MSVCRT.lib(MSVCR90.dll)
> > 1>LIBCMT.lib(tidtable.obj) : error LNK2005:
> __encode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
> > 1>LIBCMT.lib(tidtable.obj) : error LNK2005:
> __decode_pointer already defined in MSVCRT.lib(MSVCR90.dll)
> > 1>LIBCMT.lib(tolower.obj) : error LNK2005: _tolower
> already defined in MSVCRT.lib(MSVCR90.dll)
> > 1>LIBCMT.lib(invarg.obj) : error LNK2005:
> __invoke_watson already defined in MSVCRT.lib(MSVCR90.dll)
> > 1>LIBCMT.lib(invarg.obj) : error LNK2005:
> __invalid_parameter_noinfo already defined in
> MSVCRT.lib(MSVCR90.dll)
> > 1>LIBCMT.lib(lconv.obj) : error LNK2005:
> _localeconv already defined in MSVCRT.lib(MSVCR90.dll)
> >
> >
>
> If you want to use LIBCMT, then rebuild the ANTLR runtime
> libraries to
> link with that. They are using MSVCRT by default
> (multi-threaded DLL).
> Or, just change your project to use MSVCRT if you
> didn't specifically
> mean to to use the static libraries with it.
>
> Jim
>
>
>
> >
> >
> >
> >
> >
> > List:
> http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >
More information about the antlr-interest
mailing list