[antlr-interest] compiling examples with the C target

Drew Shaw darwin401 at gmail.com
Wed Jul 14 17:55:15 PDT 2010


I am having trouble with the using the C target.  I downloaded the C
examples and ran
java -cp /usr/local/antlr/antlr-3.2.jar
 in the directory of one of the example directories.  This produced the
parser and lexer files as expected. I tried compiling the examples using
gcc *.c -I/usr/local/include -L/usr/local/lib -o arbitrary
I got some errors regarding missing header files.
I fixed this by repalcing the angle brackets in the files with quotes so the
header files could be found in the current directory.  After this I tried to
compile the project once again and got the following.

drew at ubuntu:~/Desktop/examples-v3/C/island-grammar$ gcc *.c
-I/usr/local/include
-L/usr/local/lib -o ff
/tmp/ccyVyMvd.o: In function `callJavadoc':
javadocctl.c:(.text+0x3a): undefined reference to
`antlr3CommonTokenStreamSourceNew'
/tmp/cc75UF4Q.o: In function `JavadocLexerNewSSD':
JavadocLexer.c:(.text+0x8d): undefined reference to `antlr3LexerNewStream'
/tmp/ccOb1COu.o: In function `JavadocParserNewSSD':
JavadocParser.c:(.text+0x7a): undefined reference to `antlr3ParserNewStream'
/tmp/ccfeeQI8.o: In function `main':
main.c:(.text+0x39): undefined reference to `antlr3AsciiFileStreamNew'
main.c:(.text+0xd8): undefined reference to
`antlr3CommonTokenStreamSourceNew'
/tmp/cc2S4tNM.o: In function `callSimple':
simplectl.c:(.text+0x3a): undefined reference to
`antlr3CommonTokenStreamSourceNew'
/tmp/ccxtwI9q.o: In function `SimpleLexerNewSSD':
SimpleLexer.c:(.text+0x8d): undefined reference to `antlr3LexerNewStream'
/tmp/ccXvuQL5.o: In function `SimpleParserNewSSD':
SimpleParser.c:(.text+0x7d): undefined reference to `antlr3ParserNewStream'
collect2: ld returned 1 exit status
drew at ubuntu:~/Desktop/examples-v3/C/island-grammar$ ls
input                         javadoc.h        main.c         SimpleLexer.h
islandfuncs.h                 JavadocLexer.c   output         SimpleParser.c
island-grammar.vcproj         JavadocLexer.h   simplectl.c    SimpleParser.h
island-grammar.vcproj.vspscc  JavadocParser.c  Simple.g       Simple.tokens
javadocctl.c                  JavadocParser.h  simple.h
Javadoc.g                     Javadoc.tokens   SimpleLexer.c

Dose anyone have any suggestions about things to try to get rid of these
errors?


More information about the antlr-interest mailing list