您的位置:首页 > 运维架构

GCC Command Options ( GCC 命令行选项 )

2017-04-28 16:08 459 查看

Using the GNU Compiler Collection

3 GCC Command Options

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking.

当您调用GCC时,通常会进行预处理,编译,汇编和链接。

The “overall options” allow you to stop this process at an intermediate stage.

您想在任何中间阶段停止此过程都有对应的”全局选项”

For example, the ‘-c’ option says not to run the linker.

例如,
'-c'
选项表示不运行链接器。

Then the output consists of object fles outputby the assembler.

然后输出由汇编器目标文件组成的输出。

See Section 3.2 [Options Controlling the Kind of Output], page 27.

请参见 3.2 节 [ 控制输出种类的选项 ],第27页

Other options are passed on to one or more stages 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;

您可以使用的GCC大多数命令行选项都可用于对C程序;

when an option is only useful with another language (usually C++), the explanation says so explicitly.

当一个选项仅能用于一种语言时(通常是C++),本手册会明确说明。

If the description for a particular option does not mention a source language, you can use that option with all supported languages.

如果个别选项的描述未提及源语言,则该选项可以被GCC所有支持的语言共用。

The usual way to run GCC is to run the executable called gcc,

or machine-gcc when cross-compiling,

or machine-gcc-version to run a specifc version of GCC.

运行GCC的通常方法是运行名为
gcc
的可执行文件,

或者在交叉编译时运行名为
machine-gcc
的可执行文件,

再或者使用
machine-gcc-version
来运行GCC的指定版本。

When you compile C++ programs, you should invoke GCC as g++ instead.

当您编译 C++ 程序时,您应该调用 GCC 中的 g++ 来替代 gcc

See Section 3.3 [Compiling C++ Programs], page 33, for information about the differences in behavior between gcc and g++ when compiling C++ programs.

有关编译C++程序时 gcc 和 g++ 之间的差别,请参见第 3.3节[编译C++程序],第33页。

The gcc program accepts options and file names as operands.

gcc程序接受选项和文件名作为操作数。

Many options have multiletter names;

许多选项有多个名字;

therefore multiple single-letter options may not be grouped: ‘-dv’ is very different from ‘-d -v’.

所以许多单字母的选项不能合在一起:
'-dv'
'-d -v'
是完全不同的

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 specifed.

Also, the placement of the ‘-l’ option is significant.

例如,如果多次指定
'-L'
,将会按照指定的顺序搜索目录。此外,
'-l'
选项的放置位置也是是非常重要的。

Many options have long names starting with‘-f’or with‘-W’—for example,‘-fmove-loop-invariants’,‘-Wformat’ and so on.

许多选项的名字以
'-f'
'-W'
开头——例如,
'-fmove-loop-invariants'
,
'-Wformat'


Most of these have both positive and negative forms; the negative form of ‘-ffoo’ is ‘-fno-foo’.

这类选项大多数都有正、反的形式;
'-ffoo'
的相反形式是
'-fno-foo'


This manual documents only one of these two forms, whichever one is not the default.

See [Option Index], page 847, for an index to GCC’s options.

本手册仅提供这两种形式中的一种,无论哪种都不是默认值。

有关GCC选项的索引,请参阅[选项索引],第847页。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息