[antlr-interest] undefined reference to `antlr3AsciiFileStreamNew' in compiling for c target

Jesse Prabawa j.prabawa at gmail.com
Tue Jun 5 08:35:07 PDT 2012


Hi,

Im trying to build a c++ lexer from the c++ grammar and files provided at
http://www.antlr.org/grammar/1295920686207/antlr3.2_cpp_parser4.1.0.zip

but when I compile the produced lexer and parser c files, I get the
following error:

$ g++ CPP_grammar_Lexer.c cpp_full_prog.cpp -o cpp_full_prog -I . -I
/usr/local/include/ -I antlr_include/ -I antlr_src/ -L /usr/local/lib/
-lantlr3c
/tmp/ccbK10NA.o: In function `mComment(CPP_grammar_Lexer_Ctx_struct*)':
CPP_grammar_Lexer.c:(.text+0xb611): undefined reference to
`deferredNewline()'
/tmp/ccbK10NA.o: In function `mSpace(CPP_grammar_Lexer_Ctx_struct*)':
CPP_grammar_Lexer.c:(.text+0xbadb): undefined reference to `tab()'
/tmp/ccbK10NA.o: In function
`mEndOfContinuedLine(CPP_grammar_Lexer_Ctx_struct*)':
CPP_grammar_Lexer.c:(.text+0xbfd5): undefined reference to
`deferredNewline()'
/tmp/ccbK10NA.o: In function
`mLineDirective(CPP_grammar_Lexer_Ctx_struct*)':
CPP_grammar_Lexer.c:(.text+0x11902): undefined reference to
`process_line_directive(char const*, char const*)'
/tmp/ccbK10NA.o: In function `mWhitespace(CPP_grammar_Lexer_Ctx_struct*)':
CPP_grammar_Lexer.c:(.text+0x123c0): undefined reference to
`deferredNewline()'
/tmp/ccbK10NA.o: In function `mID(CPP_grammar_Lexer_Ctx_struct*)':
CPP_grammar_Lexer.c:(.text+0x133a9): undefined reference to
`deferredNewline()'
CPP_grammar_Lexer.c:(.text+0x13764): undefined reference to
`deferredNewline()'
CPP_grammar_Lexer.c:(.text+0x13b6a): undefined reference to
`deferredNewline()'
/tmp/cccO28aR.o: In function `main':
cpp_full_prog.cpp:(.text+0x171): undefined reference to
`antlr3AsciiFileStreamNew'
cpp_full_prog.cpp:(.text+0x24c): undefined reference to
`CPP_grammar_ParserNew'
collect2: ld returned 1 exit status

I've already installed the c runtime library from
http://www.antlr.org/download/C/libantlr3c-3.4.tar.gz and as you can see
above, I've already included all that I can think of for g++.

I think I may be missing something very simple. Any help would be
appreciated.

Thanks,

Jesse


More information about the antlr-interest mailing list