[antlr-interest] Error compiling generated C code (possibly 32/64 bit conflict?)
Andy Grove
andy.grove at codefutures.com
Tue Jan 20 13:46:46 PST 2009
Jim,
Thanks for the prompt response. Yes, I did run "make install" and the antlr3
header files are in /usr/local/include. I get different errors if I remove
those headers so the header files are being discovered.
I am using this syntax to call the compiler:
g++ -I$ANTLR_INCLUDE_PATH -O0 -g3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP
-MF"src/sqlparser/DbsMySQL_CPPLexer.d"
-MT"src/sqlparser/DbsMySQL_CPPLexer.d" -o"output/DbsMySQL_CPPLexer.o"
"src/sqlparser/DbsMySQL_CPPLexer.c"
I'm compiling as C++. Is this supported? I'd like to call into C++ code from
the parser.
To provide a bit more detail, here is a larger portion of error output:
In file included from src/sqlparser/DbsMySQL_CPPLexer.c:27:
src/sqlparser/DbsMySQL_CPPLexer.h:371:1: warning: "NULL" redefined
In file included from /usr/include/rpc/netdb.h:42,
from /usr/include/netdb.h:33,
from /usr/local/include/antlr3defs.h:253,
from /usr/local/include/antlr3.h:4,
from src/sqlparser/DbsMySQL_CPPLexer.h:144,
from src/sqlparser/DbsMySQL_CPPLexer.c:27:
/usr/lib/gcc/x86_64-redhat-linux/4.3.2/include/stddef.h:400:1: warning: this
is the location of the previous definition
In file included from src/sqlparser/DbsMySQL_CPPLexer.c:27:
src/sqlparser/DbsMySQL_CPPLexer.h:414:1: warning: "DELETE" redefined
In file included from /usr/include/arpa/nameser.h:531,
from /usr/local/include/antlr3defs.h:249,
from /usr/local/include/antlr3.h:4,
from src/sqlparser/DbsMySQL_CPPLexer.h:144,
from src/sqlparser/DbsMySQL_CPPLexer.c:27:
/usr/include/arpa/nameser_compat.h:127:1: warning: this is the location of
the previous definition
src/sqlparser/DbsMySQL_CPPLexer.c: In function
'DbsMySQL_CPPLexer_Ctx_struct*
DbsMySQL_CPPLexerNew(ANTLR3_INPUT_STREAM_struct*)':
src/sqlparser/DbsMySQL_CPPLexer.c:447: error: invalid conversion from 'int'
to 'ANTLR3_RECOGNIZER_SHARED_STATE_struct*'
src/sqlparser/DbsMySQL_CPPLexer.c:447: error: initializing argument 2 of
'DbsMySQL_CPPLexer_Ctx_struct*
DbsMySQL_CPPLexerNewSSD(ANTLR3_INPUT_STREAM_struct*,
ANTLR3_RECOGNIZER_SHARED_STATE_struct*)'
src/sqlparser/DbsMySQL_CPPLexer.c: In function
'DbsMySQL_CPPLexer_Ctx_struct*
DbsMySQL_CPPLexerNewSSD(ANTLR3_INPUT_STREAM_struct*,
ANTLR3_RECOGNIZER_SHARED_STATE_struct*)':
src/sqlparser/DbsMySQL_CPPLexer.c:465: error: ISO C++ forbids comparison
between pointer and integer
src/sqlparser/DbsMySQL_CPPLexer.c:468: error: invalid conversion from 'int'
to 'DbsMySQL_CPPLexer_Ctx_struct*'
src/sqlparser/DbsMySQL_CPPLexer.c:488: error: ISO C++ forbids comparison
between pointer and integer
src/sqlparser/DbsMySQL_CPPLexer.c:491: error: invalid conversion from 'int'
to 'DbsMySQL_CPPLexer_Ctx_struct*'
src/sqlparser/DbsMySQL_CPPLexer.c: At global scope:
src/sqlparser/DbsMySQL_CPPLexer.c:681: error: invalid conversion from 'int'
to 'const ANTLR3_INT32*'
Thanks,
Andy.
On Tue, Jan 20, 2009 at 2:19 PM, Jim Idle <jimi at temporal-wave.com> wrote:
> Andy Grove wrote:
> > Hi,
> >
> > I installed the ANTLR C runtime (version 3.1.1) and compiled it from
> > source successfully on Fedora 10 x86_64 (using the --enable-64bit
> > configuration option).
> >
> > I also generated C code successfully from my grammar.
> >
> > However, when I attempt to compile the generated code I get a lot of
> > type conversion errors such as:
> >
> > MyLexer.c:1634: error: invalid conversion from 'int' to 'const
> > ANTLR3_INT32*'
> >
> > The code that produces this error is:
> >
> > /* Transition tables are a table of sub tables, with some tables
> > * reused for efficiency.
> > */
> > static const ANTLR3_INT32 * const dfa31_transitions[] =
> > {
> > dfa31_T0, dfa31_T139, dfa31_T171, dfa31_T56, dfa31_T131, dfa31_T36,
> > dfa31_T27, dfa31_T147, dfa31_T149, dfa31_T125, dfa31_T170,
> > dfa31_T33,
> >
> >
> > I am using g++ (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7).
> >
> Are you trying to compile it as C++ code? Did you use:
> -I/usr/local/wherantlris and of course run 'make install' Looks like
> perhaps it hasn't picked up the header files. make sure you read the
> example in the docs.
>
> Jim
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090120/c687c2fc/attachment.html
More information about the antlr-interest
mailing list