From: noname AT noname DOT org (Stuart Hall) Newsgroups: comp.os.msdos.djgpp,alt.comp.lang.learn.c-c++ Subject: Re: Problem implementing multiple moduled program Date: Wed, 27 Jan 1999 18:57:53 GMT Organization: Connix - The Connecticut Internet Exchange Lines: 68 Message-ID: <36b05fef.19943524@news> References: <36b41be7 DOT 2525182 AT news> <36AE2EF6 DOT 3AC3 AT seidata DOT com> NNTP-Posting-Host: m5.aetna.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent 1.5/32.452 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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. Sorry for the waste of bandwidth, but here are my proggies again. I am this | | close!! /*getsafe.h */ char *getsafe(char *buffer, int count); /*getsafe.c */ #include #include extern char result; extern int result_num; char *getsafe(char *buffer, int count) { char *result = buffer, *np; if ((buffer==NULL) || (count <1)) result = NULL; else if (count == 1) *result = '\0'; else if ((result = fgets(buffer, count, stdin)) != NULL) if ((np = strchr(buffer, '\n'))) *np = '\0'; return result; } /*main.c */ #include #include #include "getsafe.h" char result[80]; int result_num=sizeof(result); int main(void) { printf("Enter up to %d characters: ",result_num-1); getsafe(result, result_num); printf("your string is %s",result); return 0; } Thanks again! Stuart ---- Stuart Hall Connecticut, USA * return address: f p r i n t @ i n a m e . c o m *