[antlr-interest] Issue when compiling c files generate by antlr

Jay T dr.jaymahdi at gmail.com
Sun Sep 12 16:40:25 PDT 2010


Hi:

Try compiling with ./configure --enable-64bit, and also don't forget to
include the -I '/path/to/antlr/header/files' in your gcc . Hopefully that
works.

Cheers

J



On Sun, Sep 12, 2010 at 4:59 PM, Armel BOURGON-DROUOT
<bourgon.a at gmail.com>wrote:

> Hello everyone,
>
> I will use antlr in an academic project. For now I just want to set up
> the environment (under mac osx 10.6.
> Following the examples from my teacher I face an issue:
>
> 1) I have installed ANTLRWorks, and I'm able to generate *Lexer.c/h and
> *Parser.c/h from the *.g file given by my teacher.
>
> 2) To compile these files I download libantlr3c then I compile and install
> it by :
> ./configure
> make
> sudo make install
>  After that I have libantlr3c.a, libantlr3c.la and libantlr3c.dylib in
> /usr/local/lib.
>
> 3) I try to compile the c files using this makefile :
>
> name = Calculette
>
> all: ./output/$(name)Parser.c ./output/$(name)Parser.h
> gcc main.c ./output/$(name)Lexer.c ./output/$(name)Parser.c
> -L/usr/local/lib
> -l antlr3c -o run
>
> Main.c is a part of my teacher example.
> but I get this message :
>
> gcc main.c ./output/CalculetteLexer.c ./output/CalculetteParser.c
> -L/usr/local/lib -l antlr3c -o run
> ld: warning: in /usr/local/lib/libantlr3c.a, file was built for unsupported
> file format which is not the architecture being linked (x86_64)
> Undefined symbols:
>  "_antlr3CommonTokenStreamSourceNew", referenced from:
>      _main in ccdRYqut.o
>  "_antlr3ParserNewStream", referenced from:
>      _CalculetteParserNewSSD in ccwb3FmC.o
>  "_antlr3AsciiFileStreamNew", referenced from:
>      _main in ccdRYqut.o
>  "_antlr3LexerNewStream", referenced from:
>      _CalculetteLexerNewSSD in cciBqC4b.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make: *** [all] Error 1
>
> Maybe I can try to compile libantlr3c for x86_64 but i don't know how. Any
> ideas ?
> --
> Armel BOURGON-DROUOT
>
> 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