needaname16
May 31st, 2001, 05:03 AM
Hi Everyone,
I have a multiple source file C program, that contains header files for global variables. When I create a header file using static declaration it compiles and links ok, however the scope is wrong because the variable changes value according to what it last was in the current C file not the new value changed in the last C file.
I tried to make the static declaration in the main procedure then create extern references in the other c source files however the linker is unable to resolve the extern references.
Does anyone have a suggestion on how to get a global variable to have scope over multiple c files.
In anticipation of the reply
:) Thanks a million :)
I have a multiple source file C program, that contains header files for global variables. When I create a header file using static declaration it compiles and links ok, however the scope is wrong because the variable changes value according to what it last was in the current C file not the new value changed in the last C file.
I tried to make the static declaration in the main procedure then create extern references in the other c source files however the linker is unable to resolve the extern references.
Does anyone have a suggestion on how to get a global variable to have scope over multiple c files.
In anticipation of the reply
:) Thanks a million :)