GCC Command Options ( GCC 命令行選項 )

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頁。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章