I would like to suggest you to manage global variables correctly....
I you use them then create them in a one extra file with the keyword extern.
There are more errors reported in the file. Not only presented in the question.
I do not want to study the logic of your application. First of all you have to process global variables on the basis of other error reports.
For example simple check (search in files) of the variable cntErrorRetry:
(defined twice as a global variable, but not only defined but also initialized twice. The common global variable can be defined and initialized only once. Of course, the only defined can be in any module if you use keyword " extern" but initialized only once.)
Best regards,
Ladislav
Ladislav,
Is there anywhere I can learn about managing global variables correctly.
If you did see global values initialized twice. Where were they I cannot find them.
I am 67 and a self taught programmer so will have many bad rabbits
Ray.
Hi,
entire web is full of explanation how to use global variables in C.
However, when I want to use variable defined in some module (let's say file1.c) as global and make it visible to other modules then I define it in the file1.h as extern and as global in the module file1.c.
file1.h: extern UBYTE var1;
file1.c: UBYTE var 1 = 10;
This approach I use when the variable is closely connected to given module functionality and I want to create connection of its global variables to other modules.
However, if I have some variables I want to be global for each module..like program setup values, general counters,....then I create extra globalDefs.c and GlobalDefs.h where I create such variables (myCounter in the example in module myfile1.c/h).
I have attached an example you can step through and look into variables window which variable is processed.
(Of course, the CodeWarrior provides some simplification in usage of keyword extern but I use it to inform myself I did everything and know how the variable will be used)
The main problem, I think, in your project is a multiply initialization of commonly used global variables as a part of definition.
Best regards,
Ladislav
Thank you for the example.
Ray.