[antlr-interest] Unresolved externals building C executable

Jim Idle jimi at temporal-wave.com
Fri Jul 11 09:56:40 PDT 2008


On Fri, 2008-07-11 at 08:56 +0100, Artemus Ward wrote:

> I spent much of yesterday afternoon teasing out the C examples;
> hassling with MS Visual Studio registration; building the ANTLR
> libraries for my target machine, and just generally rediscovering why
> I had started out using Java for this project--but I digress.


Mostly, C programmers have the same issues with CLASSPATH, -jar and so
on, none of which were designed to solve these kind of things, but you
get used to it. It's just a matter of having the information stored in
your head ;-) Starting out your question by saying you don't want to use
something generally tends to put off the people that wrote it, but I
understand your frustration, so...

> 
> I'm getting a load of missing externals when I try to link my little
> "hello antlr" program:
> 
> Microsoft (R) Incremental Linker Version 9.00.21022.08
> Copyright (C) Microsoft Corporation.  All rights reserved.
> 
> /out:GrantLexer.exe
> /NODEFAULTLIB:MSVCRT
> /LTCG
> GrantLexer.obj
> GrantParser.obj
> Test.obj
> C:\antlr-3.0.1\runtime\C\Release\antlr3c.lib
>    Creating library GrantLexer.lib and object GrantLexer.exp
> Test.obj : error LNK2001: unresolved external symbol _ANTLR3_FPRINTF
> antlr3c.lib(antlr3lexer.obj) : error LNK2001: unresolved external
> symbol __imp__fprintf


You are linking with the wrong libraries or have set up the project
incorrectly in some way. If you have the examples working, then copy the
settings from there. HOwever:

1) Create a new project and don't change the library settings;
2) Get a test to work;
3) Then add your existing things;
4) You have turned off MSVCRT, which is the C runtime - you won't get
very far without that ;-)

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080711/6961a3ad/attachment.html 


More information about the antlr-interest mailing list