[antlr-interest] Antlr C target with LibXML

Ivan Brezina ibre5041 at ibrezina.net
Thu Jul 21 02:02:47 PDT 2011


Hi,
try to execute the compiler like "gcc -E -P" and check the output.
Or try to compile the output manually.
ANTLR adds a define for each token you declare and these macro definitions
do interfere with some datatype present in libxml headers.

For example if you create your own token called "int" in .g
then the GLexer.h will contain a macro definition

#define int <some number>

When you declare your own token names, you should always use some prefix.

Ivan
PS: did you try to switch the order of headers included?
PS2: <off-topic> on the other hand it is impossible to compile ANTLR headers
with QT, because QT contains macro called "emit" white emit is a name
of the function in antlr headers.


Quoting Jim Idle <jimi at temporal-wave.com>:

> The header files are interfering with each other. You probably need to
> separate your logic from your parser .g file. However, unless you post all
> of your project it is hard to see why. Look at the lines indicated as in
> error and you will probably find some symbol that ANTLR defines that
> libXML is also defining. When you know what it is, you can possibly undef
> it before including the libXML headers. I will also try to make time
> tomorrow to have a look at this.
>
> Jim
>
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Richard Walton
>> Sent: Wednesday, July 20, 2011 6:04 PM
>> To: antlr-interest at antlr.org
>> Subject: [antlr-interest] Antlr C target with LibXML
>>
>> Forgive me if this is not the correct etiquette for asking questions -
>> This is the first mailing list I've subscribed to.  I'm having a
>> problem compiling an application using LibXML2 (http://xmlsoft.org/)
>> with a C lexer/grammar generated from ANTLR.  My problems are
>> documented here:
>> http://stackoverflow.com/questions/6769548/antlr-c-target-and-xmllib
>>
>> I would be very grateful for any help in fixing the problem.
>>
>> Kind regards,
>> Richard
>>
>> 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
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the antlr-interest mailing list