G
Guybrush Threepwood
This is a simplified example of a problem I'm having:
typedef struct node {
int a;
int b;
} NODE;
Somewhere in my code following lines can be found:
switch(op) {
case someLabel:
NODE *n = node(1, 2);
break;
default:
break;
}
Now when I compile this code with gcc version 3.4.6, I get an error:
error: syntax error before '*' token
error: `n' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
This has to do with the fact the declaration of *n is the first line of
the case. If I put, for example, an fprintf before the declaration, the
code compiles fine.
typedef struct node {
int a;
int b;
} NODE;
Somewhere in my code following lines can be found:
switch(op) {
case someLabel:
NODE *n = node(1, 2);
break;
default:
break;
}
Now when I compile this code with gcc version 3.4.6, I get an error:
error: syntax error before '*' token
error: `n' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
This has to do with the fact the declaration of *n is the first line of
the case. If I put, for example, an fprintf before the declaration, the
code compiles fine.