20.09.2015 Views

Programming in C

Kochan - ProgramminginC

Kochan - ProgramminginC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C<br />

Compil<strong>in</strong>g Programs with gcc<br />

THIS APPENDIX SUMMARIZES SOME OF THE more commonly used gcc options. For<br />

<strong>in</strong>formation about all command-l<strong>in</strong>e options, under Unix, type the command man gcc.<br />

You can also visit the gcc Web site, http://gcc.gnu.org/onl<strong>in</strong>edocs,for complete<br />

onl<strong>in</strong>e documentation.<br />

This appendix summarizes the command-l<strong>in</strong>e options available <strong>in</strong> gcc,release 3.3,<br />

and does not cover extensions added by other vendors, such as Apple Computer, Inc.<br />

General Command Format<br />

The general format of the gcc command is<br />

gcc [options] file [file …]<br />

Items enclosed <strong>in</strong> square brackets are optional.<br />

Each file <strong>in</strong> the list is compiled by the gcc compiler. Normally, this <strong>in</strong>volves preprocess<strong>in</strong>g,<br />

compil<strong>in</strong>g, assembl<strong>in</strong>g, and l<strong>in</strong>k<strong>in</strong>g. Command-l<strong>in</strong>e options can be used to alter<br />

this sequence.<br />

The suffix of each <strong>in</strong>put file determ<strong>in</strong>es the way the file is <strong>in</strong>terpreted.This can be<br />

overridden with the –x command-l<strong>in</strong>e option (consult the gcc documentation).Table<br />

C.1 conta<strong>in</strong>s a list of common suffixes.<br />

Table C.1<br />

Suffix<br />

Common Source File Suffixes<br />

Mean<strong>in</strong>g<br />

.c C language source file<br />

.cc, .cpp C++ language source file<br />

.h Header file<br />

.m Objective-C source file<br />

.pl<br />

Perl source file<br />

.o Object (precompiled file)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!