From: George Foot Newsgroups: comp.os.msdos.djgpp Subject: Re: What to use to Compile Date: 23 Apr 1998 07:00:58 GMT Organization: Oxford University, England Lines: 44 Message-ID: <6hmova$fkr$1@news.ox.ac.uk> References: <6hmg4r$ri2$1 AT news DOT mel DOT aone DOT net DOT au> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 23 Apr 1998 14:23:01 +1000 in comp.os.msdos.djgpp Access One 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