📄 invoking-gcc.html
字号:
<html lang="en">
<head>
<title>Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
<!--
Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Funding
Free Software", the Front-Cover texts being (a) (see below), and with
the Back-Cover Texts being (b) (see below). A copy of the license is
included in the section entitled "GNU Free Documentation License".
<p>(a) The FSF's Front-Cover Text is:
<p>A GNU Manual
<p>(b) The FSF's Back-Cover Text is:
<p>You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.-->
</head>
<body>
<div class="node">
<p>
Node:<a name="Invoking%20GCC">Invoking GCC</a>,
Next:<a rel="next" accesskey="n" href="C-Implementation.html#C%20Implementation">C Implementation</a>,
Previous:<a rel="previous" accesskey="p" href="Standards.html#Standards">Standards</a>,
Up:<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr><br>
</div>
<h2 class="chapter">GCC Command Options</h2>
<p>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 <code>-c</code> option
says not to run the linker. Then the output consists of object files
output by the assembler.
<p>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.
<p>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.
<p>See <a href="Invoking-G--.html#Invoking%20G++">Compiling C++ Programs</a>, for a summary of special
options for compiling C++ programs.
<p>The <code>gcc</code> program accepts options and file names as operands. Many
options have multi-letter names; therefore multiple single-letter options
may <em>not</em> be grouped: <code>-dr</code> is very different from <code>-d -r</code>.
<p>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 <code>-L</code> more than once,
the directories are searched in the order specified.
<p>Many options have long names starting with <code>-f</code> or with
<code>-W</code>--for example, <code>-fforce-mem</code>,
<code>-fstrength-reduce</code>, <code>-Wformat</code> and so on. Most of
these have both positive and negative forms; the negative form of
<code>-ffoo</code> would be <code>-fno-foo</code>. This manual documents
only one of these two forms, whichever one is not the default.
<p>See <a href="Option-Index.html#Option%20Index">Option Index</a>, for an index to GCC's options.
<ul class="menu">
<li><a accesskey="1" href="Option-Summary.html#Option%20Summary">Option Summary</a>: Brief list of all options, without explanations.
<li><a accesskey="2" href="Overall-Options.html#Overall%20Options">Overall Options</a>: Controlling the kind of output:
an executable, object files, assembler files,
or preprocessed source.
<li><a accesskey="3" href="Invoking-G--.html#Invoking%20G++">Invoking G++</a>: Compiling C++ programs.
<li><a accesskey="4" href="C-Dialect-Options.html#C%20Dialect%20Options">C Dialect Options</a>: Controlling the variant of C language compiled.
<li><a accesskey="5" href="C---Dialect-Options.html#C++%20Dialect%20Options">C++ Dialect Options</a>: Variations on C++.
<li><a accesskey="6" href="Objective-C-Dialect-Options.html#Objective-C%20Dialect%20Options">Objective-C Dialect Options</a>: Variations on Objective-C.
<li><a accesskey="7" href="Language-Independent-Options.html#Language%20Independent%20Options">Language Independent Options</a>: Controlling how diagnostics should be
formatted.
<li><a accesskey="8" href="Warning-Options.html#Warning%20Options">Warning Options</a>: How picky should the compiler be?
<li><a accesskey="9" href="Debugging-Options.html#Debugging%20Options">Debugging Options</a>: Symbol tables, measurements, and debugging dumps.
<li><a href="Optimize-Options.html#Optimize%20Options">Optimize Options</a>: How much optimization?
<li><a href="Preprocessor-Options.html#Preprocessor%20Options">Preprocessor Options</a>: Controlling header files and macro definitions.
Also, getting dependency information for Make.
<li><a href="Assembler-Options.html#Assembler%20Options">Assembler Options</a>: Passing options to the assembler.
<li><a href="Link-Options.html#Link%20Options">Link Options</a>: Specifying libraries and so on.
<li><a href="Directory-Options.html#Directory%20Options">Directory Options</a>: Where to find header files and libraries.
Where to find the compiler executable files.
<li><a href="Spec-Files.html#Spec%20Files">Spec Files</a>: How to pass switches to sub-processes.
<li><a href="Target-Options.html#Target%20Options">Target Options</a>: Running a cross-compiler, or an old version of GCC.
<li><a href="Submodel-Options.html#Submodel%20Options">Submodel Options</a>: Specifying minor hardware or convention variations,
such as 68010 vs 68020.
<li><a href="Code-Gen-Options.html#Code%20Gen%20Options">Code Gen Options</a>: Specifying conventions for function calls, data layout
and register usage.
<li><a href="Environment-Variables.html#Environment%20Variables">Environment Variables</a>: Env vars that affect GCC.
<li><a href="Running-Protoize.html#Running%20Protoize">Running Protoize</a>: Automatically adding or removing function prototypes.
</ul>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -