From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP compiles wrong .EXE filename Date: Tue, 07 Jan 1997 20:22:48 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 51 Message-ID: <32D32118.76E0@cs.com> References: <5auogm$7hn AT news DOT interlog DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp108.cs.com 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 Gautam N. Lad wrote: > > When I compile my C++ program and link it to the graphics library, > instead of the executable file having the same name as the source > file, it's A.EXE and so is the .OUT file (A.OUT). > > I am compiling like this in C: > gcc prog.c > > I am compiling like this in C++ > gxx tb.cpp window.cpp /djgpp/contrib/grx20/lib/LIBGRX20.A Did you actually read the DJGPP documentation or just start compiling "out of the box"? Try reading 'readme.1st', which gives several examples of command lines, and the documentation for gcc, which explains everything. To specify the name of the output file from gcc, use the '-o' parameter like so: gcc -o prog.exe prog.c This will output 'prog.exe'. As for your C++ example, you aren't linking the library right. All you need to do is use the '-l' parameter to specify the library. So that example would be: gxx -o tb.exe tb.cpp window.cpp -lgrx20 This will link your program using [lib]grx20[.a], and output 'tb.exe'. There are some other parameters that you should use most of the time: -Wall Reports lots of warnings that aren't on by default. -O Optimize -g Include debugging information in the executable. This would make the above command lines into: gcc -Wall -O -g -o prog.exe prog.c gcc -Wall -O -g -o tb.exe tb.cpp window.cpp -lgrx20 You can use gcc parameters for lots more things as well; read the documentation! -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Plan: To find ANYONE willing to | http://www.cs.com/fighteer | | play Descent 2 on DWANGO! | Tagline: | ---------------------------------------------------------------------