Mail Archives: djgpp/1999/01/27/14:42:07
OK Stuart, I make it a good practice to give each header file a unique
name using #define, the reason being that if 2 modules need to use the
same header file they'll get tangled up at link time. So:
#ifndef GETSAFE_LIB
#define GETSAFE_LIB
char *getsafe(char *buffer, int count);
#endif
In my opinion would be better
Stuart Hall wrote:
>
> On Tue, 26 Jan 1999 13:09:10 -0800, Marvin G Wise Jr
> <mgwise AT seidata DOT com> so kindly spent valuable time writing:
>
> >
> >Well, if this is the function prototype in your header file then it
> >should have a semicolon at the end...
> >
> > char *getsafe(char *buffer, int count);
> >
>
> Ok, I tried this, and got a few more errors. Now my program looks
> like this, both modules compile just fine -- but when the linker gets
> to them it gives me an error:
>
> creating multiple.exe:
> Error: getsafe.o: In function 'getsafe':
> getsafe.c(8): Error multiple definition of 'getsafe'
> 0:getsafe.c(8): Error first defined here.
>
> ----
> Stuart Hall
> Connecticut, USA
> * return address: f p r i n t @ i n a m e . c o m *
--
**********************************************************************
* Sahab Yazdani * In wars, fools kill fools for foolish *
* Thornhill Secondary School * reasons - Thom Merrilin (WoT) *
**********************************************************************
* http://www.geocities.com/TimesSquare/Bunker/8994/index.html * Y2K? *
* Click the link to visit my portion of The Neverhood * A-OK *
**********************************************************************
- Raw text -