bazza wrote:
I finally stumbled on using static after seeing this used on an external variable in Datebook example.
After appending static to every variable all the link errors dissappeared.
I also found that I could simply insert these external variables with static at the head of the same segments as the functions and it appears that in this way I don't even have to declare them as extern from the functions. Amazing and so easy.
I admit this is a C problem but there is no guide on the use of external variables using extern in either Code Warrior or Palm documents.
I am happy to use this solution for now but I notice in Datebook there are some external variables that do not use the static symbol. That is still a mystery as I still get an error if I try to do that.
Please look up what you are doing here...
By making all variables static, every file/object that includes Globals.c has a
local copy of that variable, and I'm pretty sure that's not what you want.
What you want to do is:
1. Add the file Globals.c to your project
2. Create a file Globals.h that references all those global variables as extern (so it contains all the extern definitions of the global variables in Globals.c
3. Where you now include Globals.c, you should include Globals.h instead
4. Link
5. See how it works like it should!
And please, read up on the proper use of C, as you don't really know what you're doing.