From: "Alexander Ehrath" Newsgroups: comp.os.msdos.djgpp References: <6l1ssn$hpf AT bgtnsc03 DOT worldnet DOT att DOT net> Subject: Re: Multiple Includes & Program Global Data Date: Tue, 2 Jun 1998 19:26:52 -0700 Lines: 37 NNTP-Posting-Host: 209.142.28.141 Message-ID: <3574b56e.0@blushng.jps.net> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk You could just create a .CPP file that actually allocates your global data and then put only a reference to it in thematching .HPP file. Then the header can always be included, but the CPP file with the actual global data only gets compiled once. Also it helps to "wrap" the header with a #ifndef _MY_HEADER_HPP #define _MY_HEADER_HPP void MyFunction(void); extern char MyData; #endif Then the CPP file would have the actual definition: void MyFunction(void) { blah blah } char MyData That should work. Greetings, Alex Scott Holisky wrote in message <6l1ssn$hpf AT bgtnsc03 DOT worldnet DOT att DOT net>... >Question: I need to use the same header file in 2 source code files to >pass around global data. How??? On the other compilers that I use, >there's a derective that tells the compiler to compile the header only >once, but allow both source code files to use it and everything in it. >How can this be done??? > I use RHIDE and have a tired old 386. GCC, LIBC and all are updated to >the current versions. Any help would be great. > > - Thanks, Adam > >P.S. If there's another way to use global data on the program level, >please share. And if this is a hopeless cause, mabye I'll look into >editing the source code...