J
John den Haan
Hello all!
In my game, I have a structure defined as follows:
typedef struct vegetation {
vegetation_type type;
bool harvested;
int wood_yield;
int fruit_content;
int asciiChar;
int color;
char description[];
} vegetation;
Later in the same header, I instantiate this type as follows:
vegetation VEG_NONE = {VEG_TYPE_NONE,false,0,0,0,0,"None"};
This is obviously required, since the flexible array-member cannot be
dynamically initialized.
However, the linker cokes on this with the following error message:
main.c: multiple definition of `VEG_NONE'
graphics.c: first defined here
Why is this? I have properly encapsulated the header file in an
#ifndef,#define, #endif structure. So what could be happening?
--
Cheers,
John den Haan
joDhn[dot]haEan[at]chLello[dot]nl
Remove capital 'DEL' from above addy to obtain e-mail address
In my game, I have a structure defined as follows:
typedef struct vegetation {
vegetation_type type;
bool harvested;
int wood_yield;
int fruit_content;
int asciiChar;
int color;
char description[];
} vegetation;
Later in the same header, I instantiate this type as follows:
vegetation VEG_NONE = {VEG_TYPE_NONE,false,0,0,0,0,"None"};
This is obviously required, since the flexible array-member cannot be
dynamically initialized.
However, the linker cokes on this with the following error message:
main.c: multiple definition of `VEG_NONE'
graphics.c: first defined here
Why is this? I have properly encapsulated the header file in an
#ifndef,#define, #endif structure. So what could be happening?
--
Cheers,
John den Haan
joDhn[dot]haEan[at]chLello[dot]nl
Remove capital 'DEL' from above addy to obtain e-mail address