Global variables and scope

I've always understood that variables declared outside of a function, including setup() and loop() had global scope and are accessible from any function, but are variables global if they're declared in separate project files, but still outside of a function?

My project is spilt into several 'pde' files and in each file I have a variable that's outside of any function. I assumed that these variables would have global scope and be visible to all functions, but it seem not to be so as the compiler is complaining that they haven't been declared where I want to use them. Is there a 'workaround' for this problem, please?

Jim

extern

Thanks for the reply.

I was afraid the 'e' word would get mentioned - I've never really got to grips with the subject!

I thought variables defined outside of any function were external anyway, and are visible throughout the program!

Jim

jimford:
I thought variables defined outside of any function were external anyway, and are visible throughout the program!

No, you have to declare them as such in each file.

extern global int globalVarFromAnotherFile;

Thanks for the reply 'skyjumper' - I'll give it a try.

Jim