www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/19/01:18:15

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: compiling
Date: Fri, 18 Jul 1997 21:22:37 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 41
Message-ID: <33CFDE9D.5E0D@cs.com>
References: <19970718015800 DOT VAA17312 AT ladder01 DOT news DOT aol DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp104.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Bond170 wrote:
> 
> I have read readme.1st and faq2.01 and have downloaded the appropriate
> files for C and have unzipped them.  my files are in c:\djgpp\... and I
> have saved a program called test.c in c:\cfiles\test.c.  Now, how do I
> compile the program.  Please answer quickly so that i get the response
> before I throw this computer out my window.  Microsoft has their windows,
> I have mine.

Read readme.1st:

GCC is a command-line compiler, which you invoke from DOS command
line.  To compile and link a single-file C program, use a command like
this:

	gcc myfile.c -o myfile.exe -lm

The -lm links in the lib/libm.a library (trig math) if needed.  (Link
order is significant, so if you need libm.a, always put `-lm' at the
end of the command line.)

--snip--

It goes on for several more paragraphs.

The best overall command line to use for most purposes is this:

gcc -Wall -O -g -o myprog.exe myfile.c [file2.c file3.c ...] [-llibrary]

'-Wall' turns on extra warnings.  '-O' optimizes your code for size and
speed.  '-g' adds extra debugging information.  When compiling C++,
replace 'gcc' with 'gxx'.  Add libraries only to the end of the command
line.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       |"A competent and self-confident person|
|       aka Fighteer I       | is incapable of jealousy in anything.|
|   mailto:fighteer AT cs DOT com   | Jealousy is invariably a symptom of  |
| http://www.cs.com/fighteer | neurotic insecurity."  - Lazarus Long|
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019