[antlr-interest] Unresolved externals building C executable

Artemus Ward coddbotherer at googlemail.com
Fri Jul 11 10:35:38 PDT 2008


2008/7/11 Jim Idle <jimi at temporal-wave.com>:
> On Fri, 2008-07-11 at 22:08 +1200, Gavin Lambert wrote:
>
> At 21:37 11/07/2008, Artemus Ward wrote:
>  >If I don't use /NODEFAULTLIB:MSVCRT then I get these errors
>  >instead:
> [...]
>  >MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined
> in
>  >LIBCMT.lib(free.obj)
>  >MSVCRT.lib(MSVCR90.dll) : error LNK2005: _calloc already defined
>
>  >in LIBCMT.lib(calloc.obj)
>
> Which means that you've probably set the ANTLR library to use the
> CRT DLL and the application to use the CRT statically.  They must
> agree with each other exactly if you're going to statically link
> them.
>
> There really is not any reason to use the static versions of the libraries -
> you should abandon your current MS project and create a new one. This time
> don't change the default settings until you know what they all mean.

I didn't start changing them off until the MS compiler and linker
started displaying messages suggesting that was the thing to do.
Clearly one could spend a long time reading the copious documentation,
but one could also seek the advice of those who've done it already.

I shall do as you suggest, although that means I now have to go back
and figure out why I was able to compile the static libraries
successfully but the DLL is somehow corrupt.  I didn't knowingly mess
with any flags when I built it.

Art


More information about the antlr-interest mailing list