Hi,
Hi, I have a typedefed struct, and later when I declare multiple const structures and want to use a field of one in an inialization, I get the following error: "error C2099: initializer is not a constant".
typedef struct {
int Start;
int attribute;
} MyStructure ;
#define FIRST 1
const MyStructure STRUCT0={FIRST, 0} ;
const MyStructure STRUCT1={STRUCT 0.Start+5, 25} ;
const MyStructure STRUCT2={STRUCT 1.Start+35, 175} ;
Any idea about to solve this? It's a c program, and I'm compiling it under Visual Studio 2008.
I don't want to remove the "#define" because it allows me to change multiple structures at once and is more clear conceptually (actuall sometimes FIRST can be a different number), and also I don't want to use the definition in the second, third and following structs declarations because I have multiple defines that are used, and the expressions will become huge as I have more than 20 of this types of structs.
TIA & Regards ...
Hi, I have a typedefed struct, and later when I declare multiple const structures and want to use a field of one in an inialization, I get the following error: "error C2099: initializer is not a constant".
typedef struct {
int Start;
int attribute;
} MyStructure ;
#define FIRST 1
const MyStructure STRUCT0={FIRST, 0} ;
const MyStructure STRUCT1={STRUCT 0.Start+5, 25} ;
const MyStructure STRUCT2={STRUCT 1.Start+35, 175} ;
Any idea about to solve this? It's a c program, and I'm compiling it under Visual Studio 2008.
I don't want to remove the "#define" because it allows me to change multiple structures at once and is more clear conceptually (actuall sometimes FIRST can be a different number), and also I don't want to use the definition in the second, third and following structs declarations because I have multiple defines that are used, and the expressions will become huge as I have more than 20 of this types of structs.
TIA & Regards ...
Comment