GCC Command-Line Options
The list of command-line options GCC accepts runs to several pages, so Table 29-2 describes only
the most common ones. (Type man gcc to see a more complete list of options available with GCC.)
784
Programming in Linux Part VI
TABLE 29-2
GCC Command-Line Options
Option Description
-ansi Supports the ANSI/ISO C standard, turning off GNU extensions that conflict with
the standard.
-c Compiles without linking, resulting in an object file but not an executable binary.
-Dfoo=bar Defines a preprocessor macro foo with a value of bar on the command line.
-g Includes standard debugging information in the binary.
-ggdb Includes lots of debugging information in the binary that only the GNU debugger
(GDB) can understand.
-Idirname Prepends dirname to the list of directories searched for include files.
-Ldirname Prepends dirname to the list of directories searched for library files. By default,
gcc links against shared libraries.
-lfoo Links against libfoo.
-MM Outputs a make-compatible dependency list.
-o file Creates the output file file (not necessary when compiling object code). If file
is not specified, the default is a.out.
-O Optimizes the compiled code.
-On Specifies an optimization level n, 0<=n<=3.
-pedntic Emits all warnings required by the ANSI/ISO C standard.
Pages:
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420