In Unix, I have got three main files. One of them is a library and the other one is a program.
MyLib.c
andMyLib.h
are the library.main.c
is the program.
In MyLib.h
I have a declaration (extern int Variable;
). When I try to use Variable
in main.c
I cannot. Of course I have included MyLib.h
in MyLib.c
and in main.c
, and I link them too. Anyway the variable is not recognized in main.c
.
How do I get the variable available when I link the program?