From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Error in single-step compilation. Date: Sun, 15 Dec 1996 05:25:41 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 39 Message-ID: <32B3FC55.61BA@cs.com> References: <19961215 DOT 193027 DOT 5007 DOT 0 DOT chambersb AT juno DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp107.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Benjamin D Chambers DJ-Gateway: from newsgroup comp.os.msdos.djgpp Benjamin D Chambers wrote: > > tc.bat (used for compiling it) > @gcc -c t.c -o t.exe -v The culprit is that '-c' in the argument list. It tells gcc to proceed only to the object code generation stage, but _not_ to link the result. So what you are getting is a 't.exe' that isn't really an executable; it's just a regular object file which should have a '.o' extension. Trying to run 't.exe' would probably cause either a DOS error or a really nasty crash, depending. Remove the '-c' and you'll be fine. But I strongly recommend that you also add '-Wall', '-g', and '-O' to that command line, to catch as many problems as you possibly can, enable debugging, and perform basic optimizations. Also, if you are going to use the '-c' option, which is useful in certain circumstances, do NOT explictly specify an output file with '-o', but let gcc pick a suitable default. This will work in almost every case, and prevents you from getting "fake" '.exe' files. :) FYI, the '@', when used as the first character of a line in a batch file, tells DOS not to echo that line. If you use it on the command line itself, it tells many programs to open the indicated file and use it for additional command-line arguments. So, "gcc -o foo.exe foo.c @gcc.opt" would tell gcc to look in the file 'gcc.opt' for additional arguments. But this is not in any way related to your problem. I suggest you take a look at the gcc documentation/reference guide that comes with DJGPP; simply type "info gcc" to learn all about the various command line options at your disposal. If you don't have info, you need to get the 'v2gnu/txi390b.zip' package. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Descent 2: The Infinite Abyss - The greatest Internet game of all | | time just got better! This time, you're going all the way down...| ---------------------------------------------------------------------