The code below works under IDE 1.0. Under 1.0.5 I get this error message:
test.ino: In function ‘void setup()’:
test:31: error: expected primary-expression before ‘{’ token
And here is the code. I've marked the line to which the error message applies. This was part of a much longer 800 line sketch but I've stripped out everything but the section of code that's provoking the error. Being new to C I've looked in various books and tried searching about structures without finding anything useful. I would initialize the menu structures at the time they are declared but because they are self-referential then all need to exist before they are assigned to.
Anyone know what I'm doing wrong and/or why it works under 1.0 but not under 1.05? Thanks.
struct Menu {
char *Text; //Pointer to our text
void (*Action)(); //Pointer to our action routine
struct Menu *Next; //Pointer to the next menu entry at this level
struct Menu *Prev; //Pointer to the previous menu entry at this level
struct Menu *Down; //Pointer to the menu entry one level down
struct Menu *Up; //Pointer to our parent
};
struct Menu Menu00;
struct Menu Menu01;
struct Menu Menu02;
struct Menu Menu03;
struct Menu Menu04;
struct Menu Menu05;
struct Menu Menu06;
struct Menu Menu07;
struct Menu Menu08;
struct Menu Menu09;
struct Menu Menu10;
struct Menu Menu11;
struct Menu Menu12;
struct Menu Menu13;
struct Menu Menu14;
struct Menu Menu15;
struct Menu Menu16;
void setup()
{
Menu00 = { "Run", NULL, &Menu01, NULL , NULL , NULL }; // This line gets the error message----------
Menu01 = { "Setup", NULL, &Menu13, &Menu00, &Menu02, NULL };
Menu02 = { "Times", NULL, &Menu09, NULL , &Menu03, &Menu01 };
Menu03 = { "Dev", NULL, &Menu04, NULL , NULL , &Menu02 };
Menu04 = { "Stop", NULL, &Menu05, &Menu03, NULL , &Menu02 };
Menu05 = { "Fix1", NULL, &Menu06, &Menu04, NULL , &Menu02 };
Menu06 = { "Fix2", NULL, &Menu07, &Menu05, NULL , &Menu02 };
Menu07 = { "Wash1", NULL, &Menu08, &Menu06, NULL , &Menu02 };
Menu08 = { "Wash2", NULL, NULL , &Menu07, NULL , &Menu02 };
Menu09 = { "Fixes", NULL, &Menu10, &Menu02, NULL , &Menu01 };
Menu10 = { "Washer", NULL, &Menu11, &Menu09, NULL , &Menu01 };
Menu11 = { "Speed", NULL, &Menu12, &Menu10, NULL , &Menu01 };
Menu12 = { "Accel", NULL, NULL , &Menu11, NULL , &Menu01 };
Menu13 = { "Test", NULL, NULL , &Menu01, &Menu14, NULL };
Menu14 = { "Opt", NULL, &Menu15, NULL , NULL , &Menu13 };
Menu15 = { "Ma", NULL, &Menu16, &Menu14, NULL , &Menu13 };
Menu16 = { "Mb", NULL, NULL , &Menu15, NULL , &Menu13 };
}
void loop()
{
}