Message-ID: <36AF6665.D826F381@geocities.com> From: Sahab Yazdani X-Mailer: Mozilla 4.5 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp,alt.comp.lang.learn.c-c++ Subject: Re: Problem implementing multiple moduled program References: <36b41be7 DOT 2525182 AT news> <36AE2EF6 DOT 3AC3 AT seidata DOT com> <36b05fef DOT 19943524 AT news> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 47 Date: Wed, 27 Jan 1999 14:17:57 -0500 NNTP-Posting-Host: 209.103.50.123 X-Complaints-To: abuse AT sprint DOT ca X-Trace: hme2.newscontent-01.sprint.ca 917464865 209.103.50.123 (Wed, 27 Jan 1999 14:21:05 EDT) NNTP-Posting-Date: Wed, 27 Jan 1999 14:21:05 EDT Organization: Sprint Canada Inc. To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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 > 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 * **********************************************************************