delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/09/10:00:20

Date: Fri, 9 May 1997 09:00:20 -0500 (CDT)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: rellwood <rellwood AT aludra DOT usc DOT edu>
cc: djgpp AT delorie DOT com
Subject: Re: Global Variables
In-Reply-To: <Pine.SV4.3.94.970508164914.13011B-100000@aludra.usc.edu>
Message-ID: <Pine.SUN.3.95.970509090004.12699B-100000@ernie.eecs.uic.edu>
MIME-Version: 1.0

In your header file, on top put something like this:
#ifndef _MY_HEADER_FILE
#define _MY_HEADER_FILE
...
your header stuff
...
#endif /* at the end of header file */

that should solve your problem.


On 8 May 1997, 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.
> 
> What am I suppose to do here?
> 
> Muchos thanks,
> Richard Ellwood
> 
> 
> 
> -- 
> 
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019