1<html lang="en"> 2<head> 3<title>Invoking GCC - Using the GNU Compiler Collection (GCC)</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using the GNU Compiler Collection (GCC)"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Standards.html#Standards" title="Standards"> 9<link rel="next" href="C-Implementation.html#C-Implementation" title="C Implementation"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1988-2013 Free Software Foundation, Inc. 13 14Permission is granted to copy, distribute and/or modify this document 15under the terms of the GNU Free Documentation License, Version 1.3 or 16any later version published by the Free Software Foundation; with the 17Invariant Sections being ``Funding Free Software'', the Front-Cover 18Texts being (a) (see below), and with the Back-Cover Texts being (b) 19(see below). A copy of the license is included in the section entitled 20``GNU Free Documentation License''. 21 22(a) The FSF's Front-Cover Text is: 23 24 A GNU Manual 25 26(b) The FSF's Back-Cover Text is: 27 28 You have freedom to copy and modify this GNU Manual, like GNU 29 software. Copies published by the Free Software Foundation raise 30 funds for GNU development.--> 31<meta http-equiv="Content-Style-Type" content="text/css"> 32<style type="text/css"><!-- 33 pre.display { font-family:inherit } 34 pre.format { font-family:inherit } 35 pre.smalldisplay { font-family:inherit; font-size:smaller } 36 pre.smallformat { font-family:inherit; font-size:smaller } 37 pre.smallexample { font-size:smaller } 38 pre.smalllisp { font-size:smaller } 39 span.sc { font-variant:small-caps } 40 span.roman { font-family:serif; font-weight:normal; } 41 span.sansserif { font-family:sans-serif; font-weight:normal; } 42--></style> 43<link rel="stylesheet" type="text/css" href="../cs.css"> 44</head> 45<body> 46<div class="node"> 47<a name="Invoking-GCC"></a> 48<p> 49Next: <a rel="next" accesskey="n" href="C-Implementation.html#C-Implementation">C Implementation</a>, 50Previous: <a rel="previous" accesskey="p" href="Standards.html#Standards">Standards</a>, 51Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 52<hr> 53</div> 54 55<h2 class="chapter">3 GCC Command Options</h2> 56 57<p><a name="index-GCC-command-options-67"></a><a name="index-command-options-68"></a><a name="index-options_002c-GCC-command-69"></a> 58<!-- man begin DESCRIPTION --> 59When you invoke GCC, it normally does preprocessing, compilation, 60assembly and linking. The “overall options” allow you to stop this 61process at an intermediate stage. For example, the <samp><span class="option">-c</span></samp> option 62says not to run the linker. Then the output consists of object files 63output by the assembler. 64 65 <p>Other options are passed on to one stage of processing. Some options 66control the preprocessor and others the compiler itself. Yet other 67options control the assembler and linker; most of these are not 68documented here, since you rarely need to use any of them. 69 70 <p><a name="index-C-compilation-options-70"></a>Most of the command-line options that you can use with GCC are useful 71for C programs; when an option is only useful with another language 72(usually C++), the explanation says so explicitly. If the description 73for a particular option does not mention a source language, you can use 74that option with all supported languages. 75 76 <p><a name="index-C_002b_002b-compilation-options-71"></a>See <a href="Invoking-G_002b_002b.html#Invoking-G_002b_002b">Compiling C++ Programs</a>, for a summary of special 77options for compiling C++ programs. 78 79 <p><a name="index-grouping-options-72"></a><a name="index-options_002c-grouping-73"></a>The <samp><span class="command">gcc</span></samp> program accepts options and file names as operands. Many 80options have multi-letter names; therefore multiple single-letter options 81may <em>not</em> be grouped: <samp><span class="option">-dv</span></samp> is very different from ‘<samp><span class="samp">-d -v</span></samp>’<!-- /@w -->. 82 83 <p><a name="index-order-of-options-74"></a><a name="index-options_002c-order-75"></a>You can mix options and other arguments. For the most part, the order 84you use doesn't matter. Order does matter when you use several 85options of the same kind; for example, if you specify <samp><span class="option">-L</span></samp> more 86than once, the directories are searched in the order specified. Also, 87the placement of the <samp><span class="option">-l</span></samp> option is significant. 88 89 <p>Many options have long names starting with ‘<samp><span class="samp">-f</span></samp>’ or with 90‘<samp><span class="samp">-W</span></samp>’—for example, 91<samp><span class="option">-fmove-loop-invariants</span></samp>, <samp><span class="option">-Wformat</span></samp> and so on. Most of 92these have both positive and negative forms; the negative form of 93<samp><span class="option">-ffoo</span></samp> is <samp><span class="option">-fno-foo</span></samp>. This manual documents 94only one of these two forms, whichever one is not the default. 95 96<!-- man end --> 97 <p>See <a href="Option-Index.html#Option-Index">Option Index</a>, for an index to GCC's options. 98 99<ul class="menu"> 100<li><a accesskey="1" href="Option-Summary.html#Option-Summary">Option Summary</a>: Brief list of all options, without explanations. 101<li><a accesskey="2" href="Overall-Options.html#Overall-Options">Overall Options</a>: Controlling the kind of output: 102 an executable, object files, assembler files, 103 or preprocessed source. 104<li><a accesskey="3" href="Invoking-G_002b_002b.html#Invoking-G_002b_002b">Invoking G++</a>: Compiling C++ programs. 105<li><a accesskey="4" href="C-Dialect-Options.html#C-Dialect-Options">C Dialect Options</a>: Controlling the variant of C language compiled. 106<li><a accesskey="5" href="C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options">C++ Dialect Options</a>: Variations on C++. 107<li><a accesskey="6" href="Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options.html#Objective_002dC-and-Objective_002dC_002b_002b-Dialect-Options">Objective-C and Objective-C++ Dialect Options</a>: Variations on Objective-C 108 and Objective-C++. 109<li><a accesskey="7" href="Language-Independent-Options.html#Language-Independent-Options">Language Independent Options</a>: Controlling how diagnostics should be 110 formatted. 111<li><a accesskey="8" href="Warning-Options.html#Warning-Options">Warning Options</a>: How picky should the compiler be? 112<li><a accesskey="9" href="Debugging-Options.html#Debugging-Options">Debugging Options</a>: Symbol tables, measurements, and debugging dumps. 113<li><a href="Optimize-Options.html#Optimize-Options">Optimize Options</a>: How much optimization? 114<li><a href="Preprocessor-Options.html#Preprocessor-Options">Preprocessor Options</a>: Controlling header files and macro definitions. 115 Also, getting dependency information for Make. 116<li><a href="Assembler-Options.html#Assembler-Options">Assembler Options</a>: Passing options to the assembler. 117<li><a href="Link-Options.html#Link-Options">Link Options</a>: Specifying libraries and so on. 118<li><a href="Directory-Options.html#Directory-Options">Directory Options</a>: Where to find header files and libraries. 119 Where to find the compiler executable files. 120<li><a href="Spec-Files.html#Spec-Files">Spec Files</a>: How to pass switches to sub-processes. 121<li><a href="Target-Options.html#Target-Options">Target Options</a>: Running a cross-compiler, or an old version of GCC. 122<li><a href="Submodel-Options.html#Submodel-Options">Submodel Options</a>: Specifying minor hardware or convention variations, 123 such as 68010 vs 68020. 124<li><a href="Code-Gen-Options.html#Code-Gen-Options">Code Gen Options</a>: Specifying conventions for function calls, data layout 125 and register usage. 126<li><a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>: Env vars that affect GCC. 127<li><a href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>: Compiling a header once, and using it many times. 128</ul> 129 130<!-- man begin OPTIONS --> 131 </body></html> 132 133