[antlr-interest] Compilation linking error with ANTLR 3.x

Jim Idle jimi at temporal-wave.com
Mon Sep 6 09:18:10 PDT 2010


You are almost certainly #defining something that is in conflict with the
generated headers. You should start with the basic generated code, then add
in your headers one at a time until you find out which one goes awry. Quite
often an include order change will fix thigns.

But generally, you should have almost zero code embedded in your grammar
except references to some external helper object that does all the work for
you. It looks to me like your code is all glommed together and interrelated?

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Thomas Davis
> Sent: Monday, September 06, 2010 5:07 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Compilation linking error with ANTLR 3.x
> 
> Hi all,
> 
> Just wondering if anyone could help me out with this. I've got ANTLR 3.2
as
> part of a qt project, its compiled using qmake and then makefiles to
initiate
> the compilation. Within one of my files i include the antlr lexer and
parser
> which was produced using the C target. I should mention this is being
> compiled into a c++ project. Whenever i try to compile i get the following
> error:
> 
> 
> make[1]: Entering directory
> `/home/timmas/UniWork/2010/semester2/SEGP2_RSP2010/projects/guiGe
> n/trunk/src'
> g++ -c -pipe -frtti -Wall -Wextra -pg -fprofile-arcs -ftest-coverage
> g++ -frtti
> -Wall -Wextra -pg -fprofile-arcs -ftest-coverage -g -Wall -W -
> I/usr/local/include/yaml-cpp -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB
> -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -
> I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I.
-I.. -
> I../include -I../include/lib -I../include -I../include/lib
-I../include/components
> -I../build -o ../build/ComponentDescriptorUtil.o
> ../src/components/ComponentDescriptorUtil.cpp
> In file included from /usr/local/include/antlr3baserecognizer.h:363,
>                  from /usr/local/include/antlr3cyclicdfa.h:38,
>                  from /usr/local/include/antlr3.h:40,
>                  from ../include/components/AntlrLexer.h:96,
>                  from ../include/components/ExpressionParser.h:3,
>                  from ../include/components/ConditionTree.h:5,
>                  from ../include/components/ComponentDescriptor.h:25,
>                  from ../include/components/NodeItem.h:8,
>                  from ../include/components/ComponentDescriptorUtil.h:5,
>                  from ../src/components/ComponentDescriptorUtil.cpp:1:
> /usr/local/include/antlr3lexer.h:130: error: expected unqualified-id
before ')'
> token
> make[1]: *** [../build/ComponentDescriptorUtil.o] Error 1
> make[1]: Leaving directory
> `/home/timmas/UniWork/2010/semester2/SEGP2_RSP2010/projects/guiGe
> n/trunk/src'
> make: *** [sub-src-make_default-ordered] Error 2
> 
> 
> AntlrLexer.h is the header file for the lexer produced by ANTLR, which is
> included from expression parser which is included from ConditionTree etc..
I
> have absolutely no idea what this error is or how to fix it, and i've
tried
> installation of the antlr libraries (all 3.x version) across both windows
and
> Ubuntu and both give me the same error in the same file, i.e. at this line
in
> the Antlr Source:
> 
>     /** Pointer to a function that constructs a new token from the lexer
stored
> information
>      */
>     pANTLR3_COMMON_TOKEN    (*emit)            (struct ANTLR3_LEXER_struct
> *
> lexer);
> 
> 
> Any help with this issue would be greatly appreciated, as i've wasted
> countless hours trying to solve it :(
> 
> Cheers,
> 
> Tom
> 
> 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