Mail Archives: djgpp/1998/04/23/03:32:08
On Thu, 23 Apr 1998 14:23:01 +1000 in comp.os.msdos.djgpp Access One
<grant DOT slender AT gecits DOT com DOT au> wrote:
: Hi, just wondering what I would need to type to compile these
: filenames...they are all C++
: ass3.h
: ass3.cpp => includes "ass3.h"
: ass3main.cpp => includes "ass3.h"
: I have tried gcc and gpp but I get different results...??
: What is the correct way to compile and link a program using djgpp??
To compile you use `gcc' or `gpp', with the `-c' option (add others to
your taste); this generates a .o file for each .cpp file. You don't
compile the .h file; it is only there to be included in the other two.
To link, use `gpp'. Specify the output file by using the `-o' switch,
and add others to your taste. For example:
gcc -c -O2 -Wall -g -m486 *.cpp (compiles to .o files)
gpp -o prog.exe *.o (links .o files to a .exe)
In the linking command you can use `gcc' instead, but you'd have to
manually specify any libraries it needs, e.g.
gcc -o prog.exe *.o -lstdcxx (links in the standard C++ library)
This information can be found in the file "readme.1st", which you
should read first.
You'd probably benefit from downloading and learning to use the GNU
Make utility. Get the `mak' binary zip from the v2gnu directory on
your local Simtelnet mirror, and then type:
info make
for more details.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
[sala93la91PPPP]sala93la91PPPP
- Raw text -