[antlr-interest] Compiling C runtime & linking

Yves Weißig weissig at rbg.informatik.tu-darmstadt.de
Mon Oct 24 08:12:21 PDT 2011


Hi again,
this seems to be a problem with Windows (still the same error), but I
tried the same under Linux and everything went fine. Compiled with
./configure, then make & make install. After that:

g++ -I/usr/local/include -shared -oRtfToolkit.lib -static
-L/usr/local/lib -lantlr3c RtfLexer.c RtfParser.c

Without Parser it works fine, with Parser it throws several:

RtfParser.c: In function ‘RtfParser_group_return
group(RtfParser_Ctx_struct*)’:
RtfParser.c:2113: error: no match for ‘operator=’ in ‘children = space(ctx)’
RtfParser.h:198: note: candidates are:
RtfParser_delimiter_return_struct&
RtfParser_delimiter_return_struct::operator=(const
RtfParser_delimiter_return_struct&)

I don't know what that means...

The grammar rule looks like:

group		:	(OPEN
				children+=space*
				(
				children+=group children+=space* |
				children+=plaintext children+=space* |
				(children+=command | children+=escape)
				(children+=delimiter children+=space+ | children+=delimiter | )
				)+
			CLOSE) -> ^(GROUP $children*) ;

And one final question, how can I link the ANTLR runtime statically...
the above statement (without compiling the Parser) generates a small lib
of 16kb, so the ANTLR runtime is not linked static, or am I missing a
point here?

Best regards, Yves

Am 24.10.2011 12:34, schrieb Yves Weißig:
> Hi list,
> I successfully compiled the C runtime for ANTLR with VS 2010.
> Now I want to compile the generated code (Lexer and Parser) with this
> command:
> g++ -Iantlrinclude -static -L. -lantlr3c RtfLexer.c RtfParser.c
> as you may notice, antlr.h and all includefiles are in antlrinclude and
> the antlr3c.lib (copied from the Release dir of VS solution) lies in the
> current working dir. I would like to include the runtime statically
> ("-static").
> But it throws:
> C:\Users\Yves\AppData\Local\Temp/ccctgQP2.o:RtfLexer.c:(.text+0xb9):
> undefined reference to `antlr3LexerNewStream'
> which makes me believe the library is not correctly linked... what is
> wrong here?
> Best regards, Yves
> 
> 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