Mail Archives: djgpp/1997/12/21/15:31:32
From: | David Rager <djrst14+@pitt.edu>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Beginer's Question
|
Date: | Sun, 21 Dec 1997 15:20:29 -0500
|
Organization: | University of Pittsburgh
|
Lines: | 76
|
Message-ID: | <349D7A0D.5ABE7CD9@pitt.edu>
|
References: | <34982465 DOT 0 AT news2 DOT ibm DOT net>
|
NNTP-Posting-Host: | jbddup-a-11.rmt.net.pitt.edu
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
The files are most often named somemodule.h and somemodule.cpp
and somemain.cpp
to refer to these in your sorce use the line:
#include "somemodule.h"
to compile all these in one step you need the make utility which can be
found where you got djgpp.
create one file called "makefile" no extentions, in the directory with
your source.
here is one of mine from a school project:
bank.exe: bank.o tree.o accounts.o
gxx -o bank.exe bank.o tree.o accounts.o
bank.o: bank.cpp tree.h accounts.h
gcc -c bank.cpp
tree.o: tree.cpp tree.h accounts.h
gcc -c tree.cpp
accounts.o: accounts.cpp accounts.h
gcc -c accounts.cpp
^ this white space indenting these second lines MUST be a single TAB
not padded with spaces.
accounts.* and tree.* were my separate modules and bank.cpp was my main
program.
these are set up like this:
output.file: [dependencies]
command line
once this is set, at the command line type:
make
this will run the make utility which will check all your dependencies
compiling only what is out of date
and link them. Naturally all command line switches can also be used.
Later!
Dave.
David Grant wrote:
>
> I have a source code file called set.cc which used C++ and has a class
> definition, and whatever. To compile this file, I typed this at the command
> prompt,
>
> gcc -o set.exe set.cc -lgpp
>
> I think that's pretty straightforward and I also know how to add
> the -Wall, -O, and -g options also.
>
> Now I want to split this into three files, one which has my class
> definition, the function headers/prototypes called set.h; another, which
> implements these functions, called set.* (what should I call this file?),
> and another file which included the driver code, calls to the functions,
> etc... called main.* (what should I call this file?)
>
> Well, my main questions are, (1) what should I call these files, (2) how
> should I refer to them in my source code in the #include line, and (3) how
> do I compile these into an executable in one step.
>
> If anyone can please help me it would be a great help.
>
> David Grant
--
David J. Rager
University of Pittsburgh at Johnstown
e-mail: djrst14 AT pitt DOT edu
Internet: http://www.pitt.edu/~djrst14
- Raw text -