delorie.com/archives/browse.cgi | search |
From: | "Edmund Horner" <edmund1 AT geocities DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <n1colsooqlrmkltk8f3b2hgnbinmj67jvk AT 4ax DOT com> |
Subject: | Re: problems with extern |
Lines: | 64 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600 |
Organization: | Paradise Net Ltd. Customer |
Message-ID: | <962346058.58842@shelley.paradise.net.nz> |
Cache-Post-Path: | shelley.paradise.net.nz!unknown AT 203-96-149-7 DOT tnt1 DOT paradise DOT net DOT nz |
X-Cache: | nntpcache 2.4.0b2 (see http://www.nntpcache.org/) |
Date: | Fri, 30 Jun 2000 18:21:43 +1200 |
NNTP-Posting-Host: | 203.96.152.26 |
X-Complaints-To: | newsadmin AT xtra DOT co DOT nz |
X-Trace: | news.xtra.co.nz 962346076 203.96.152.26 (Fri, 30 Jun 2000 18:21:16 NZST) |
NNTP-Posting-Date: | Fri, 30 Jun 2000 18:21:16 NZST |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Tips: * Look at the offending line, and count how many strings it contains -- my estimate is 1.5 (I think you are missing a " in there). * In file2.h, you'll need to include 'file1.h', so it has access to the Location definitions/ * In file2.h, the 'init_location' prototype should have an 'extern' in front of it. I hope that was useful. "Sean Proctor" <sproctor AT ccs DOT neu DOT edu> wrote in message news:n1colsooqlrmkltk8f3b2hgnbinmj67jvk AT 4ax DOT com... > alright, either there's a bug in djgpp or I'm an idiot... I have 4 > files. okay, here's how it's set up, pretty much > file1.c: > ... > #include "file1.h" > #include "file2.h" > ... > int function(Blah a) > { > init_location(locations); > FILE *fp = fopen("file", "rt); /* this is the offending line > according to the compiler... but the error goes away if I comment out > the line above, no I didn't forget the semi-colon. ;) */ > ... > } > ... > > file1.h: > ... > typedef struct LOCATION Location; > typedef struct BLAH Blah; > ... > struct LOCATION > { > ... > }; > struct BLAH > { > ... > }; > ... > > file2.c: > ... > Location *locations[NUMBER]; > ... > void init_location(Location *loc[]) > { > ... > } > > file2.h > void init_location(Location *[]); > ... > extern Location *locations[]; > > and I believe that's all that's relevant... I don't see anything wrong > with it... but of course I don't, I wrote it. > > Sean
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |