Programming in C

(Barry) #1

C Compiling Programs with gcc


C Compiling Programs with gcc


THIS APPENDIX SUMMARIZES SOME OF THEmore commonly used gccoptions. For
information about all command-line options, under Unix, type the command man gcc.
You can also visit the gccWeb site,http://gcc.gnu.org/onlinedocs,for complete
online documentation.
This appendix summarizes the command-line options available in gcc,release 3.3,
and does not cover extensions added by other vendors, such as Apple Computer, Inc.

General Command Format

The general format of the gcccommand is
gcc [options] file [file ...]
Items enclosed in square brackets are optional.
Each file in the list is compiled by the gcccompiler. Normally, this involves prepro-
cessing, compiling, assembling, and linking. Command-line options can be used to alter
this sequence.
The suffix of each input file determines the way the file is interpreted.This can be
overridden with the –xcommand-line option (consult the gccdocumentation).Table
C.1 contains a list of common suffixes.

Ta ble C.1 Common Source File Suffixes
Suffix Meaning
.c C language source file
.cc, .cpp C++ language source file
.h Header file
.m Objective-C source file
.pl Perl source file
.o Object (precompiled file)

22 0672326663 AppC 6/10/04 2:02 PM Page 493

Free download pdf