X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "John Hanley" Newsgroups: comp.os.msdos.djgpp Subject: Re: errors when linking Date: Thu, 26 Aug 2004 20:43:13 -0600 Organization: University of Alberta Lines: 48 Message-ID: <1093574517.26693@proxy2.srv.ualberta.ca> References: <1093551837 DOT 155041 AT proxy2 DOT srv DOT ualberta DOT ca> <200408262048 DOT i7QKmVUP029709 AT envy DOT delorie DOT com> <1093560759 DOT 721269 AT proxy2 DOT srv DOT ualberta DOT ca> <200408262337 DOT i7QNbXEt031947 AT envy DOT delorie DOT com> NNTP-Posting-Host: proxy2.srv.ualberta.ca X-Trace: tabloid.srv.ualberta.ca 1093574518 18115 129.128.5.161 (27 Aug 2004 02:41:58 GMT) X-Complaints-To: abuse AT ualberta DOT ca NNTP-Posting-Date: Fri, 27 Aug 2004 02:41:58 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Cache-Post-Path: proxy2.srv.ualberta.ca!unknown AT d198-166-59-48 DOT abhsia DOT telus DOT net X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "DJ Delorie" wrote in message news:200408262337 DOT i7QNbXEt031947 AT envy DOT delorie DOT com... > > > I was under the impression that if you #include your .h file, the > > declaration is included at compile time in your .c file. I am not > > quite sure I understand why I would need to declare them twice. > > This isn't djgpp-specific, but to summarize: > > --- foo.h --- > extern int i; > extern int f(); > > --- a.c --- > #include "foo.h" > > int v() > { > i = f(); > } > > --- b.c --- > #include "foo.h" > > int i; > > int f() > { > } That's great DJ! I didn't know this about global variables. Doing this took care of my "undefined references" errors just great! Do you have any idea what might be the problem with my "multiple definitions" error? I just have a .h file with 3 structs and a bunch of function prototypes. I #include them in my main.c and program.c files. I am not sure why I am getting these errors. I realize this may not be a DJGPP specific question, but I really do appreciate all your help. Thanks again DJ! Best regards, John