[antlr-interest] Compiling C runtime & linking

Jim Idle jimi at temporal-wave.com
Mon Oct 24 08:16:23 PDT 2011


To link statically you need to reference the .a version of the library I
think. I don't know what your other errors are as I can’t see your source
code.


Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Yves Weißig
> Sent: Monday, October 24, 2011 8:12 AM
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Compiling C runtime & linking
>
> 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
>
> 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