Array of Structures Initialization
Ramana Radhakrishnan
ramana.radhakrishnan@codito.com
Mon Nov 15 14:42:00 GMT 2004
Kevin Stedman wrote:
> Hello All,
>
> Can someone give me an idea on how to figure out what
> is going on with my initialization of an array of
> structures. This code compiles on Sun using the Sun
> One studio CC compiler. I am porting it to lnux and
> have never seen this problem before. Code examples of
> what I am trying to compile are below. Everything is
> in the C header file. When I compile I do not have
> any gcc flags except for -g -c -o. I get error
> messages: "initializer element is not constant" and
> "incompatible types in initialization" on every line
> of the initialization of the array of structures
> below.
>
> #define INTEGER4 4
> #define REAL8 8
> #define STRING 9
>
> typedef union{
> double RealX8;
> long IntX4;
> char *Str;
> } InputValue;
>
> typedef struct _Arguments{
> int keyword;
> char *prompt_string;
> char *default_string;
> int type;
> InputValue default_value;
> } Arguments;
>
> Arguments SortLightningArgs[]={
> {Title, "NLDN Sort Routine (US
> only)",NULL,INTEGER4,NULL},
> {UserDefined,"Minimum propagation
> delay",".001",REAL8,NULL},
> {UserDefined,"Maximum propagation
> delay","1.0",REAL8,NULL},
> {UserDefined,"Minimum latitude","20.0", REAL8,NULL},
> {UserDefined,"Maximum latitude","50.0", REAL8,NULL},
> {UserDefined,"Minimum longitude","-50.0",
> REAL8,NULL},
> {UserDefined,"Maximum longitude","-150.0",
> REAL8,NULL},
> {UserDefined,"Input file containing NLDN event
> times","lightning.times.251_253", STRING,NULL},
> {UserDefined,"Output file containing list of time
> differences and intensities",
> "HistoTimeDifs.txt", STRING,NULL},
> {NULL,NULL,NULL,NULL,NULL}
> };
I assume you want to define Title, UserDefined somewhere ? Also you
might like to include stdio.h for NULL ?
cheers
ramana
More information about the Gcc-help
mailing list