Noeud:Standard Compilation Options, Noeud « Next »:, Noeud « Up »:Reference Section



Standard Compilation Options

gcc [options] file [file2] ... [filen] Compile file file (and/ or [file2] ... [filen]); preprocess, compile, assemble and link, where [options] can be any of the options below:

-o outputFile Replace default file with file named outputFile. This can be used with any stage that produces as output some default file. For example, gcc -S main.c -o file.assembler will produce an assembly file named file.assembler instead of the default main.s.
-E Preprocess only; send to stdout (standard output).
-C Preserve line comments; used with -E.
-P Do not generate #line comments; used with -E.
-S Preprocess (if the file is a C source file) and compile (if the file is a preprocessed file), but do not assemble. The created file will have the suffix .s, unless the -o outputFile option is used.
-c Preprocess (if the file is a C source file), compile (if the file is a preprocessed file) and assemble (if the file is assembler source); do not link. The created file will have the suffix .o, unless the -o outputFile option is used.
-traditional Supports the traditional C language. The traditional option also supports all of the FSF's extensions to the C language.
-ansi Supports the ANSI C standard.
-pedantic Issues all the warning messages that are required by the ANSI C standard. Forbids the use of all the FSF extensions to the C language and considers the use of such extensions errors.
-DDEFN, -DDEFN=VALUE Define DEFN to have value 1, or DEFN to have value VALUE.
-UDEFN undefine definition DEFN (all -D options are evaluated before any -U options on the command line).
-v Print verbose information.
-pipe Use a pipe rather than temporary files when compiling.
-Idirectory When searching for .h header files, look in directory directory, in addition to the default directories. If spedified before the -I- option (see below), only #include "..." files are searched for. Used after -I-, -I directory will also search for any #include <...> files.
-I- Used after the -I option, it forces all succeeding -I calls to search for #include <...> files. It also negates search of the current directory; thus, to force the compiler to look in the current directory, use -I. after -I-.
-Wa,option-list Pass option-list as a list of comma separated options (with no white-space between options whatsoever) to the assembler.
-Wl,option-list Pass option-list as a list of comma separated options (with no white-space between options whatsoever) to the linker.