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

Armel BOURGON-DROUOT bourgon.a at gmail.com
Sun Sep 12 13:59:53 PDT 2010


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


More information about the antlr-interest mailing list