Tuesday, 21 August 2007

Can't compile code using g2c.h (libg2c) on gcc4

I ran into this in trying to compile nettimer. If you're seeing compile (when using gcc-4.1) errors like:
/usr/include/g2c.h:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘integer’
Then, as suggested here, just add the missing typedefs to your code (then it _should_ work in gcc4.1):

// Typedefs to keep g2c.h happy
typedef int __g77_integer;
typedef unsigned int __g77_uinteger;
typedef long int __g77_longint;
typedef unsigned long int __g77_ulongint;

#include <g2c.h>

The alternative is just to use gcc-3.4 which apparently 'just works'.

No comments:

Post a Comment