This chapter explains how to use GCC to compile executable programs from C source code. First we present the basic program control options, in the order of the corresponding steps in the compiling process. Then we look at how you can use GCC’s warning options to troubleshoot your programs. Finally, we summarize the options for optimized compiling.
This chapter should provide you with a basic working knowledge of GCC. If you later need information on special details, such as architecture-specific or system-specific options, this basic orientation will enable you to find what you need in the GCC manual . The manual is included in Texinfo format in the GCC distribution, and is also available in PostScript and HTML formats at http://gcc.gnu.org/onlinedocs/.
GCC originally stood for the “GNU C Compiler.” Since its beginnings, the program has grown to support a number of other programming languages besides C, including C++, Ada, Objective-C, Fortran, and Java. The acronym GCC has therefore been redefined to mean “GNU Compiler Collection.” The compiler incorporates a number of frontends to translate different languages. In this book, of course, we are concerned only with the C frontend.
GCC is also a multitarget compiler; in other words, it has interchangeable backends to produce executable output for a number of different computer architectures. As the modular concept would suggest, GCC can also be used as a cross-compiler; that is, ...