Did you read the documentation? Assuming you have installed the C runtime correctly, you need
gcc -I. *.c -lantlr3c The -I. means look in the current directory for include files. It will already look in /usr/include for the installed antlr includes. Also, remember http://antlr.markmail.org You can and should use java -jar and not -cp with 3.2 too. Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Drew Shaw > Sent: Wednesday, July 14, 2010 5:55 PM > To: [email protected] > Subject: [antlr-interest] compiling examples with the C target > > 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. > > d...@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 > d...@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? > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
