From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: Global Variables Date: Fri, 09 May 1997 09:46:24 -0700 Organization: Alcyone Systems Lines: 27 Message-ID: <337354E0.2895110@alcyone.com> References: NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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