This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Forward declaration is not possible


On Thursday 19 December 2002 20:22, Brian Gough wrote:
> Peter Haase writes: 
>  > //Forward declaration: 
>  > struct gsl_rng; 
> 
> Just to confirm Atakan's reply, it's legal to make a typedef for an
> incomplete struct.
>
> typedef struct gsl_rng gsl_rng;

Hi, trying to compile (with GCC 3.2 under Linux) the file phrand.cpp with code 
in line 41 as follows

//brians suggestion:
typedef struct gsl_rng gsl_rng;  

I get the following error messages:  

/usr/include/gsl/gsl_rng.h:47: conflicting types for `typedef struct gsl_rng 
gsl_rng'
phrand.h:41: previous declaration as `typedef struct gsl_rng gsl_rng'

The same error message occurs with Atakans suggestion:

typedef struct gsl_rng gsl_rng_typedef;

Hence the declaration '... struct gsl_rng ...' within line 41 in 'phrand.cpp' 
conflicts with  'typedef { ... } gsl_rng;' in file 'gsl/gsl_rng.h'

Did I something wrong or is that a non-standard conform behaviour of GCC 3.2??

Peter



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]