delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/13/23:32:11

Message-ID: <36241B40.4FDE728F@montana.com>
Date: Tue, 13 Oct 1998 21:32:16 -0600
From: bowman <bowman AT montana DOT com>
X-Mailer: Mozilla 4.5b2 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Multi-modules
References: <362410B8 DOT CE1 AT golden DOT net>
Reply-To: djgpp AT delorie DOT com

> couldn't find those pointers. Is there a different way to indicate that
> the variables are somewhere else in the program other than "extern".

no, that is the proper useage. One of the modules has to instantiate the
variable. the 'extern' is declaring that that a variable exists
someplace out of the current translation unit, and the reference will be
resolved by the linker (loader), but one of the modules must actually
define the variable so storage is assigned to it.


in this case, someplace in the third file, char* whatever has to exist,
and be visible at the global level.

exactly what errors are you getting? if you just compile one of the
files to an object file, do you get an error, or is it just in the
linking phase?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019