Chinaunix首页 | 论坛 | 博客
  • 博客访问: 392110
  • 博文数量: 103
  • 博客积分: 3073
  • 博客等级: 中校
  • 技术积分: 1078
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-23 15:04
文章分类

全部博文(103)

文章存档

2012年(13)

2011年(76)

2010年(14)

分类: C/C++

2010-03-23 17:47:32

For any given input file, the file name suffix determines what kind of compilation is done:

       file.c
           C source code which must be preprocessed.

       file.i
           C source code which should not be preprocessed.

       file.ii
           C++ source code which should not be preprocessed.

       file.m
           Objective-C source code.  Note that you must link with the libobjc library to make an Objective-C
           program work.

       file.mi
           Objective-C source code which should not be preprocessed.

       file.mm
       file.M
           Objective-C++ source code.  Note that you must link with the libobjc library to make an Objective-C++
           program work.  Note that .M refers to a literal capital M.

       file.mii
           Objective-C++ source code which should not be preprocessed.

       file.h
:        C, C++, Objective-C or Objective-C++ header file to be turned into a precompiled header.

       file.cc
       file.cp
       file.cxx
       file.cpp
       file.CPP
       file.c++
       file.C
           C++ source code which must be preprocessed.  Note that in .cxx, the last two letters must both be
           literally x.  Likewise, .C refers to a literal capital C.

       file.mm
       file.M
           Objective-C++ source code which must be preprocessed.

       file.mii
           Objective-C++ source code which should not be preprocessed.

       file.hh
       file.H
           C++ header file to be turned into a precompiled header.

       file.f
       file.for
       file.FOR
           Fixed form Fortran source code which should not be preprocessed.

       file.F
       file.fpp
       file.FPP
           Fixed form Fortran source code which must be preprocessed (with the traditional preprocessor).

       file.f90
       file.f95
           Free form Fortran source code which should not be preprocessed.

       file.F90
:       file.F95
           Free form Fortran source code which must be preprocessed (with the traditional preprocessor).

       file.ads
           Ada source code file which contains a library unit declaration (a declaration of a package, subpro-
           gram, or generic, or a generic instantiation), or a library unit renaming declaration (a package,
           generic, or subprogram renaming declaration).  Such files are also called specs.

       file.adb
           Ada source code file containing a library unit body (a subprogram or package body).  Such files are
           also called bodies.

       file.s
           Assembler code.

       file.S
           Assembler code which must be preprocessed.

       other
           An object file to be fed straight into linking.  Any file name with no recognized suffix is treated
           this way.

       You can specify the input language explicitly with the -x option:

       -x language
           Specify explicitly the 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 -x option.  Possible values for language are:

                   c  c-header  c-cpp-output
                   c++  c++-header  c++-cpp-output
                   objective-c  objective-c-header  objective-c-cpp-output
                   objective-c++ objective-c++-header objective-c++-cpp-output
                   assembler  assembler-with-cpp
                   ada
                   f95  f95-cpp-input
                   java
                   treelang

       -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 -x has not been used at all).

       -pass-exit-codes
           Normally the gcc program will exit with the code of 1 if any phase of the compiler returns a non-suc-
           cess return code.  If you specify -pass-exit-codes, the gcc program will instead return with numeri-
           cally highest error produced by any phase that returned an error indication.

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

       -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 .c, .i, .s, etc.,
           with .o.

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

       -S  Stop after the stage of compilation proper; do not assemble.  The output is in the form of an assem-
           bler 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 .c, .i, etc.,
           with .s.

           Input files that don?. require compilation are ignored.

       -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?. require preprocessing are ignored.
      -o file
           Place output in file 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.

           If -o is not specified, the default is to put an executable file in a.out, the object file for
           source.suffix in source.o, its assembler file in source.s, a precompiled header file in source.suf-
           fix.gch, and all preprocessed C source on standard output.

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

       -###
           Like -v except the commands are not executed and all command arguments are quoted.  This is useful
           for shell scripts to capture the driver-generated command lines.

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

       -combine
           If you are compiling multiple source files, this option tells the driver to pass all the source files
           to the compiler at once (for those languages for which the compiler can handle this).  This will
           allow intermodule analysis (IMA) to be performed by the compiler.  Currently the only language for
           which this is supported is C.  If you pass source files for multiple languages to the driver, using
           this option, the driver will invoke the compiler(s) that support IMA once each, passing each compiler
           all the source files appropriate for it.  For those languages that do not support IMA this option
           will be ignored, and the compiler will be invoked once for each source file in that language.  If you
           use this option in conjunction with -save-temps, the compiler will generate multiple pre-processed
           files (one for each source file), but only one (combined) .o or .s file.

阅读(846) | 评论(0) | 转发(0) |
0

上一篇:Oprofile

下一篇:opcontrol summerize

给主人留下些什么吧!~~