From: Robert Hoehne Newsgroups: comp.os.msdos.djgpp Subject: Re: Simple Query on multiple sources Date: Mon, 21 Apr 1997 16:37:54 +0200 Organization: TU Chemnitz-Zwickau Lines: 33 Message-ID: <335B7BC2.71E4@Mathematik.tu-chemnitz.de> References: <861628816 DOT 14833 DOT 0 AT itsb DOT demon DOT co DOT uk> NNTP-Posting-Host: mmu.hrz.tu-chemnitz.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk BDC Client Team wrote: > > Can anyone help me with mulitple sources? > > I understand about compiling different sources to .o files and then > linking the .o's to a .exe, but I am unsure about #includes. > > When you have (for example) two sources foo.c and bar.c and you wish to > use the allegro library, I assume that you would only need to > #include "allegro.h" in the source that has the main() procedure and that > you could call allegro routines from within the other one? Where you include the "allegro.h" has nothing to do with the main() function. A header file like "allegro.h" is used to get the prototypes of a function, which you want to call from you source file or to get some data structures. That means, you have to include that file in any source file, where you want to use any function or type from (for instance) the allegro library. And do not forget, when you link your exe, to link in it also the library liballeg.a, which has the real functions in it. Robert -- ***************************************************************** * Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau * * Post: Am Berg 3, D-09573 Dittmannsdorf * * e-Mail: Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE * * WWW: http://www.tu-chemnitz.de/~rho * *****************************************************************