[antlr-interest] Error compiling generated C code (possibly 32/64 bit conflict?)

Andy Grove andy.grove at codefutures.com
Tue Jan 20 12:53:14 PST 2009


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 there any flags I need to set when generating the C source from my  
grammar to make it compile against a 64 bit runtime?

Thanks,

Andy Grove
Chief Architect
CodeFutures Corporation









More information about the antlr-interest mailing list