typedef in function definition has a problem

The following program produces a compiler error (Arduino 0011 alpha):
struct foo{
int a;
int b;
typedef struct foo FOO;
FOO myvar[21];
FOO *myFunct(){}
void setup(){}
void loop(){}

ERROR is: error: expected constructor, destructor, or type conversion before ‘*’ token
If I change
<FOO *myFunct(){}>
<struct foo *myfunct(){}> it compiles just fine.


You need to put type definition inside a separate header file, as the function prototypes that are generated by the IDE are inserted above the typedef (but below pre-processor directives like #include). This header can be another tab in your sketch; use the right facing arrow in the upper right of the IDE.