Hi everyone,
I am having trouble using enums in structs. I am developing for the linux platform, with the gcc compiler. Below is an example of the code that produces the error.
enum Day {Monday=0x01, Tuesday=0x02, Wednesday=0x03};
typedef struct {
int numberofDays;
Day weekday;
} Week;
When I compile, I get the error
line 4 error: expected specifier-qualifier-list before 'Day’
Does anyone have an idea what might be causing this? I expect that it should be possible to declare an enum outside the struct and use it within. I have tried changing the hexes to ints in the enum, but that seems not to be the problem.
Thank you!