[antlr-interest] Getting linker errors while building the ANTLR generated sources.

Markus grey_earl at web.de
Mon Sep 22 07:09:11 PDT 2008


> 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)

The conflict seems to be between libcmt.lib and msvcrt.lib and not in 
antlr.lib, judging from the error messages you posted.

libcmt.lib is the static multithreaded C runtime, msvcrt.lib is the import 
library for the dynamic multithreaded C runtime in msvcr90.dll. So they are 
serving the same purpose and you cannot link to both of them.

Markus


More information about the antlr-interest mailing list