I have boiled a compilation problem I am having down to the following code...
I get the following compiler error...

... for the following code:
Main Project file...
void setup(){}
void loop(){}
A second tab...
typedef int T;
void f(T t1){};
If the contents of the second tab are placed in the main project file the sketch compiles.
Any help would be appreciated.
What is the full name of the file in the second tab ?
What is the full name of the file in the second tab ?
Also the following code does not throw errors declaring T's before the function declaration. The function declaration attracts the same errors as above.
typedef int T;
T t;
T t1=1;
void f(T t){};
Comment out the function declaration and the scrap of code compiles fine.
A function declaration will start a new scope for the parameter names but it should inherit the declarations from the surrounding scope. T should still be in scope.... This is probably to do with how the IDE pieces together the pieces of code to make a compilation unit.
I am going to look for a temporary file that is actually sent to the compiler....
It's the automatically generated prototype. You are getting:
void f(T t1); // Auto generated. T not defined.
void setup(){}
void loop(){}
typedef int T;
void f(T t1){};
To fix it, add a manual prototype after the declaration of 'T':
void setup(){}
void loop(){}
typedef int T;
void f(T t1); // This keeps the IDE from generating a prototype at the top of the (combined) file.
void f(T t1){};
Another option is to change the extension from .ino to .cpp. The file will be compiled separately and not have prototypes generated.
OK ... l get it. Many many thanks.