⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 invoke.texi

📁 GCC
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
Fortran source code which should not be preprocessed.

@item @var{file}.F
@itemx @var{file}.fpp
@itemx @var{file}.FPP
Fortran source code which must be preprocessed (with the traditional
preprocessor).

@item @var{file}.r
Fortran source code which must be preprocessed with a RATFOR
preprocessor (not included with GCC).

@xref{Overall Options,,Options Controlling the Kind of Output, g77,
Using and Porting GNU Fortran}, for more details of the handling of
Fortran input files.

@c FIXME: Descriptions of Java file types.
@c @var{file}.java
@c @var{file}.class
@c @var{file}.zip
@c @var{file}.jar

@c GCC also knows about some suffixes for languages not yet included:
@c Ada:
@c @var{file}.ads
@c @var{file}.adb
@c @var{file}.ada
@c Pascal:
@c @var{file}.p
@c @var{file}.pas

@item @var{file}.s
Assembler code.

@item @var{file}.S
Assembler code which must be preprocessed.

@item @var{other}
An object file to be fed straight into linking.
Any file name with no recognized suffix is treated this way.
@end table

@opindex x
You can specify the input language explicitly with the @option{-x} option:

@table @gcctabopt
@item -x @var{language}
Specify explicitly the @var{language} for the following input files
(rather than letting the compiler choose a default based on the file
name suffix).  This option applies to all following input files until
the next @option{-x} option.  Possible values for @var{language} are:
@example
c  c-header  cpp-output
c++  c++-cpp-output
objective-c  objc-cpp-output
assembler  assembler-with-cpp
f77  f77-cpp-input  ratfor
java
@end example
@c Also f77-version, for internal use only.

@item -x none
Turn off any specification of a language, so that subsequent files are
handled according to their file name suffixes (as they are if @option{-x}
has not been used at all).

@item -pass-exit-codes
@opindex pass-exit-codes
Normally the @command{gcc} program will exit with the code of 1 if any
phase of the compiler returns a non-success return code.  If you specify
@option{-pass-exit-codes}, the @command{gcc} program will instead return with
numerically highest error produced by any phase that returned an error
indication.
@end table

If you only want some of the stages of compilation, you can use
@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
one of the options @option{-c}, @option{-S}, or @option{-E} to say where
@command{gcc} is to stop.  Note that some combinations (for example,
@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.

@table @gcctabopt
@item -c
@opindex c
Compile or assemble the source files, but do not link.  The linking
stage simply is not done.  The ultimate output is in the form of an
object file for each source file.

By default, the object file name for a source file is made by replacing
the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.

Unrecognized input files, not requiring compilation or assembly, are
ignored.

@item -S
@opindex S
Stop after the stage of compilation proper; do not assemble.  The output
is in the form of an assembler code file for each non-assembler input
file specified.

By default, the assembler file name for a source file is made by
replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.

Input files that don't require compilation are ignored.

@item -E
@opindex E
Stop after the preprocessing stage; do not run the compiler proper.  The
output is in the form of preprocessed source code, which is sent to the
standard output.

Input files which don't require preprocessing are ignored.

@cindex output file option
@item -o @var{file}
@opindex o
Place output in file @var{file}.  This applies regardless to whatever
sort of output is being produced, whether it be an executable file,
an object file, an assembler file or preprocessed C code.

Since only one output file can be specified, it does not make sense to
use @option{-o} when compiling more than one input file, unless you are
producing an executable file as output.

If @option{-o} is not specified, the default is to put an executable file
in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
all preprocessed C source on standard output.@refill

@item -v
@opindex v
Print (on standard error output) the commands executed to run the stages
of compilation.  Also print the version number of the compiler driver
program and of the preprocessor and the compiler proper.

@item -pipe
@opindex pipe
Use pipes rather than temporary files for communication between the
various stages of compilation.  This fails to work on some systems where
the assembler is unable to read from a pipe; but the GNU assembler has
no trouble.

@item --help
@opindex help
Print (on the standard output) a description of the command line options
understood by @command{gcc}.  If the @option{-v} option is also specified
then @option{--help} will also be passed on to the various processes
invoked by @command{gcc}, so that they can display the command line options
they accept.  If the @option{-W} option is also specified then command
line options which have no documentation associated with them will also
be displayed.

@item --target-help
@opindex target-help
Print (on the standard output) a description of target specific command
line options for each tool.
@end table

@node Invoking G++
@section Compiling C++ Programs

@cindex suffixes for C++ source
@cindex C++ source file suffixes
C++ source files conventionally use one of the suffixes @samp{.C},
@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
files with these names and compiles them as C++ programs even if you
call the compiler the same way as for compiling C programs (usually with
the name @command{gcc}).

@findex g++
@findex c++
However, C++ programs often require class libraries as well as a
compiler that understands the C++ language---and under some
circumstances, you might want to compile programs from standard input,
or otherwise without a suffix that flags them as C++ programs.
@command{g++} is a program that calls GCC with the default language
set to C++, and automatically specifies linking against the C++
library.  On many systems, @command{g++} is also
installed with the name @command{c++}.

@cindex invoking @command{g++}
When you compile C++ programs, you may specify many of the same
command-line options that you use for compiling programs in any
language; or command-line options meaningful for C and related
languages; or options that are meaningful only for C++ programs.
@xref{C Dialect Options,,Options Controlling C Dialect}, for
explanations of options for languages related to C.
@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
explanations of options that are meaningful only for C++ programs.

@node C Dialect Options
@section Options Controlling C Dialect
@cindex dialect options
@cindex language dialect options
@cindex options, dialect

The following options control the dialect of C (or languages derived
from C, such as C++ and Objective C) that the compiler accepts:

@table @gcctabopt
@cindex ANSI support
@cindex ISO support
@item -ansi
@opindex ansi
In C mode, support all ISO C89 programs.  In C++ mode,
remove GNU extensions that conflict with ISO C++.

This turns off certain features of GCC that are incompatible with ISO
C (when compiling C code), or of standard C++ (when compiling C++ code),
such as the @code{asm} and @code{typeof} keywords, and
predefined macros such as @code{unix} and @code{vax} that identify the
type of system you are using.  It also enables the undesirable and
rarely used ISO trigraph feature.  For the C compiler,
it disables recognition of C++ style @samp{//} comments as well as
the @code{inline} keyword.

The alternate keywords @code{__asm__}, @code{__extension__},
@code{__inline__} and @code{__typeof__} continue to work despite
@option{-ansi}.  You would not want to use them in an ISO C program, of
course, but it is useful to put them in header files that might be included
in compilations done with @option{-ansi}.  Alternate predefined macros
such as @code{__unix__} and @code{__vax__} are also available, with or
without @option{-ansi}.

The @option{-ansi} option does not cause non-ISO programs to be
rejected gratuitously.  For that, @option{-pedantic} is required in
addition to @option{-ansi}.  @xref{Warning Options}.

The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
option is used.  Some header files may notice this macro and refrain
from declaring certain functions or defining certain macros that the
ISO standard doesn't call for; this is to avoid interfering with any
programs that might use these names for other things.

Functions which would normally be built in but do not have semantics
defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
built-in functions provided by GNU CC}, for details of the functions
affected.

@item -std=
@opindex std
Determine the language standard.  A value for this option must be provided;
possible values are

@table @samp
@item iso9899:1990
Same as @option{-ansi}

@item iso9899:199409
ISO C as modified in amend. 1

@item iso9899:1999
ISO C99.  Note that this standard is not yet fully supported; see
@w{@uref{http://gcc.gnu.org/gcc-3.0/c99status.html}} for more information.

@item c89
same as @option{-std=iso9899:1990}

@item c99
same as @option{-std=iso9899:1999}

@item gnu89
default, iso9899:1990 + gnu extensions

@item gnu99
iso9899:1999 + gnu extensions

@item iso9899:199x
same as @option{-std=iso9899:1999}, deprecated

@item c9x
same as @option{-std=iso9899:1999}, deprecated

@item gnu9x
same as @option{-std=gnu99}, deprecated

@end table

Even when this option is not specified, you can still use some of the
features of newer standards in so far as they do not conflict with
previous C standards.  For example, you may use @code{__restrict__} even
when @option{-std=c99} is not specified.

The @option{-std} options specifying some version of ISO C have the same
effects as @option{-ansi}, except that features that were not in ISO C89
but are in the specified version (for example, @samp{//} comments and
the @code{inline} keyword in ISO C99) are not disabled.

@xref{Standards,,Language Standards Supported by GCC}, for details of
these standard versions.

@item -aux-info @var{filename}
@opindex aux-info
Output to the given filename prototyped declarations for all functions
declared and/or defined in a translation unit, including those in header
files.  This option is silently ignored in any language other than C.

Besides declarations, the file indicates, in comments, the origin of
each declaration (source file and line), whether the declaration was
implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
@samp{O} for old, respectively, in the first character after the line
number and the colon), and whether it came from a declaration or a
definition (@samp{C} or @samp{F}, respectively, in the following
character).  In the case of function definitions, a K&R-style list of
arguments followed by their declarations is also provided, inside
comments, after the declaration.

@item -fno-asm
@opindex fno-asm
Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
keyword, so that code can use these words as identifiers.  You can use
the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
instead.  @option{-ansi} implies @option{-fno-asm}.

In C++, this switch only affects the @code{typeof} keyword, since
@code{asm} and @code{inline} are standard keywords.  You may want to
use the @option{-fno-gnu-keywords} flag instead, which has the same
effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
switch only affects the @code{asm} and @code{typeof} keywords, since
@code{inline} is a standard keyword in ISO C99.

@item -fno-builtin
@opindex fno-builtin
@cindex built-in functions
Don't recognize built-in functions that do not begin with
@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
functions provided by GNU CC}, for details of the functions affected,
including those which are not built-in functions when @option{-ansi} or
@option{-std} options for strict ISO C conformance are used because they
do not have an ISO standard meaning.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -