[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. GCC Command Options

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the `-c' option says not to run the linker. Then the output consists of object files output by the assembler.

Other options are passed on to one stage of processing. Some options control the preprocessor and others the compiler itself. Yet other options control the assembler and linker; most of these are not documented here, since you rarely need to use any of them.

Most of the command line options that you can use with GCC are useful for C programs; when an option is only useful with another language (usually C++), the explanation says so explicitly. If the description for a particular option does not mention a source language, you can use that option with all supported languages.

See section Compiling C++ Programs, for a summary of special options for compiling C++ programs.

The gcc program accepts options and file names as operands. Many options have multi-letter names; therefore multiple single-letter options may not be grouped: `-dr' is very different from `-d -r'.

You can mix options and other arguments. For the most part, the order you use doesn't matter. Order does matter when you use several options of the same kind; for example, if you specify `-L' more than once, the directories are searched in the order specified.

Many options have long names starting with `-f' or with `-W'---for example, `-fforce-mem', `-fstrength-reduce', `-Wformat' and so on. Most of these have both positive and negative forms; the negative form of `-ffoo' would be `-fno-foo'. This manual documents only one of these two forms, whichever one is not the default.

See section Option Index, for an index to GCC's options.

3.1 Option Summary  Brief list of all options, without explanations.
3.2 Options Controlling the Kind of Output  Controlling the kind of output: an executable, object files, assembler files, or preprocessed source.
3.3 Compiling C++ Programs  Compiling C++ programs.
3.4 Options Controlling C Dialect  Controlling the variant of C language compiled.
3.5 Options Controlling C++ Dialect  Variations on C++.
3.6 Options Controlling Objective-C Dialect  Variations on Objective-C.
3.7 Options to Control Diagnostic Messages Formatting  Controlling how diagnostics should be formatted.
3.8 Options to Request or Suppress Warnings  How picky should the compiler be?
3.9 Options for Debugging Your Program or GCC  Symbol tables, measurements, and debugging dumps.
3.10 Options That Control Optimization  How much optimization?
3.11 Options Controlling the Preprocessor  Controlling header files and macro definitions. Also, getting dependency information for Make.
3.12 Passing Options to the Assembler  Passing options to the assembler.
3.13 Options for Linking  Specifying libraries and so on.
3.14 Options for Directory Search  Where to find header files and libraries. Where to find the compiler executable files.
3.15 Specifying subprocesses and the switches to pass to them  How to pass switches to sub-processes.
3.16 Specifying Target Machine and Compiler Version  Running a cross-compiler, or an old version of GCC.
3.17 Hardware Models and Configurations  Specifying minor hardware or convention variations, such as 68010 vs 68020.
3.18 Options for Code Generation Conventions  Specifying conventions for function calls, data layout and register usage.
3.19 Environment Variables Affecting GCC  Env vars that affect GCC.
3.20 Running Protoize  Automatically adding or removing function prototypes.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Vincent Chung on June, 26 2001 using texi2html