UNIX/LINUX Command – gcc


gcc, g++—GNU project C and C++ Compiler (v2.7)


gcc [ option j filename ]. . .
g++ [ option j filename ]…


The information in this man page is an extract from the full documentation of the GNU C compiler and is limited to the meaning of the options.

This man page is not kept up-to-date except when volunteers want to maintain it. If you find a discrepancy between the man page and the software, please check the info file, which is the authoritative documentation.

If we find that the things in this man page that are out of date cause significant confusion or complaints, we will stop distributing the man page. The alternative, updating the man page when we update the info file, is impossible because the rest of the work of maintaining GNU CC leaves us no time for that. The GNU project regards man pages as obsolete and should not let them take time away from other things.

For complete and current documentation, refer to the info file gcc or the manual Using and Porting GNU CC (for version 2.0). Both are made from the Texinfo source file gcc.texinfo.


The C and C++ compilers are integrated. Both process input files through one or more of four stages: preprocessing, compilation, assembly, and linking. Source filename suffixes identify the source language, but which name you use for the compiler governs default assumptions:

gcc Assumes preprocessed (.i) files are C and assumes C-style linking.

g++ Assumes preprocessed (.i) files are C++ and assumes C++-style linking.

Suffixes of source filenames indicate the language and kind of processing to be done:

.c C source; preprocess, compile, assemble
.C C++ source; preprocess, compile, assemble
.cc C++ source; preprocess, compile, assemble
.cxx C++ source; preprocess, compile, assemble
.m Objective-C source; preprocess, compile, assemble
.i Preprocessed C; compile, assemble
.ii Preprocessed C++; compile, assemble
.s Assembler source; assemble
.S Assembler source; preprocess, assemble
.h Preprocessor file; not usually named on command line

Files with other suffixes are passed to the linker. Common cases include

.0 Object file
.a Archive file

Linking is always the last stage unless you use one of the –c, –S, or –E options to avoid it (or unless compilation errors stop the whole process). For the link stage, all .o files corresponding to source files, –l libraries, unrecognized filenames (including named .o object files, and .a archives) are passed to the linker in command-line order.

Related Posts

UNIX/LINUX Command – rsync

UNIX/LINUX Command – rsync

NAME rsync – a fast, versatile, remote (and local) file-copying tool rsync Command SYNOPSIS Local: rsync [OPTION…] SRC… [DEST] Access via remote shell:Pull: rsync [OPTION…] [[email protected]]HOST:SRC… [DEST]Push: rsync [OPTION…] SRC… [[email protected]]HOST:DEST Access via rsync...

UNIX/LINUX Command – strip

UNIX/LINUX Command – strip

NAME strip—Discard symbols from object files. SYNOPSIS strip [ -Fbfdname|–target=bfdname ] [ -Ibfdname|–input-target=bfdname ] [ -Obfdname|–output-target=bfdname ] [-Rsectionname|–remove-section=sectionname ] [ -s|–strip-all ] [-S|-g|–strip-debug ][-x|–discard-all...

UNIX/LINUX Command – expand

UNIX/LINUX Command – expand

NAME expand—Convert tabs to spaces SYNOPSIS expand [–tab1[,tab2[,…]]] [–t tab1[,tab2[,…]]] [–i] [—tabs=tab1[,tab2[,…]]] [–initial] [–help] [–version] [file…] DESCRIPTION This manual page documents the GNU version of expand. expand writes the contents of each given...

UNIX/LINUX Command – uuencode

UNIX/LINUX Command – uuencode

NAME uuencode—Encode a binary fileuudecode—Decode a file created by uuencode SYNOPSIS uuencode [-m] [ file ] nameuudecode [-o outfile] [ file ]… DESCRIPTION uuencode and uudecode are used to transmit binary files over transmission mediums that do not support other...

Follow Us

Our Communities

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!



Submit a Comment

Your email address will not be published.

13 + nine =