Mail Archives: djgpp/1997/05/09/15:34:48
rellwood wrote:
> How in the world do I get global variables to be global in several files
> that have been linked together? As my code is now, I have the
> declarations of the variables in a header file, but when I try to
> include
> it in more then one .c file the linker complians of multiple
> declairations. This, of course, makes perfect sense, so I tried making
> them each extern in the header file, but that didn't work either.
You need to define them as extern in the header, not declare them there.
In the module (say):
int x;
and in the header:
extern int x;
--
Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
Alcyone Systems / web / http://www.alcyone.com/max/
San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W
\
"The future / is right there."
/ Bill Moyers
- Raw text -