home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.5.8-bin.lha / GNU / info / gcc.info-2 (.txt) < prev    next >
GNU Info File  |  1994-09-02  |  48KB  |  911 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Overall Options,  Next: Invoking G++,  Prev: Option Summary,  Up: Invoking GCC
  23. Options Controlling the Kind of Output
  24. ======================================
  25.    Compilation can involve up to four stages: preprocessing, compilation
  26. proper, assembly and linking, always in that order.  The first three
  27. stages apply to an individual source file, and end by producing an
  28. object file; linking combines all the object files (those newly
  29. compiled, and those specified as input) into an executable file.
  30.    For any given input file, the file name suffix determines what kind
  31. of compilation is done:
  32. `FILE.c'
  33.      C source code which must be preprocessed.
  34. `FILE.i'
  35.      C source code which should not be preprocessed.
  36. `FILE.ii'
  37.      C++ source code which should not be preprocessed.
  38. `FILE.m'
  39.      Objective-C source code.  Note that you must link with the library
  40.      `libobjc.a' to make an Objective-C program work.
  41. `FILE.h'
  42.      C header file (not to be compiled or linked).
  43. `FILE.cc'
  44. `FILE.cxx'
  45. `FILE.cpp'
  46. `FILE.C'
  47.      C++ source code which must be preprocessed.  Note that in `.cxx',
  48.      the last two letters must both be literally `x'.  Likewise, `.C'
  49.      refers to a literal capital C.
  50. `FILE.s'
  51.      Assembler code.
  52. `FILE.S'
  53.      Assembler code which must be preprocessed.
  54. `OTHER'
  55.      An object file to be fed straight into linking.  Any file name
  56.      with no recognized suffix is treated this way.
  57.    You can specify the input language explicitly with the `-x' option:
  58. `-x LANGUAGE'
  59.      Specify explicitly the LANGUAGE for the following input files
  60.      (rather than letting the compiler choose a default based on the
  61.      file name suffix).  This option applies to all following input
  62.      files until the next `-x' option.  Possible values for LANGUAGE
  63.      are:
  64.           c  objective-c  c++
  65.           c-header  cpp-output  c++-cpp-output
  66.           assembler  assembler-with-cpp
  67. `-x none'
  68.      Turn off any specification of a language, so that subsequent files
  69.      are handled according to their file name suffixes (as they are if
  70.      `-x' has not been used at all).
  71.    If you only want some of the stages of compilation, you can use `-x'
  72. (or filename suffixes) to tell `gcc' where to start, and one of the
  73. options `-c', `-S', or `-E' to say where `gcc' is to stop.  Note that
  74. some combinations (for example, `-x cpp-output -E' instruct `gcc' to do
  75. nothing at all.
  76.      Compile or assemble the source files, but do not link.  The linking
  77.      stage simply is not done.  The ultimate output is in the form of an
  78.      object file for each source file.
  79.      By default, the object file name for a source file is made by
  80.      replacing the suffix `.c', `.i', `.s', etc., with `.o'.
  81.      Unrecognized input files, not requiring compilation or assembly,
  82.      are ignored.
  83.      Stop after the stage of compilation proper; do not assemble.  The
  84.      output is in the form of an assembler code file for each
  85.      non-assembler input file specified.
  86.      By default, the assembler file name for a source file is made by
  87.      replacing the suffix `.c', `.i', etc., with `.s'.
  88.      Input files that don't require compilation are ignored.
  89.      Stop after the preprocessing stage; do not run the compiler
  90.      proper.  The output is in the form of preprocessed source code,
  91.      which is sent to the standard output.
  92.      Input files which don't require preprocessing are ignored.
  93. `-o FILE'
  94.      Place output in file FILE.  This applies regardless to whatever
  95.      sort of output is being produced, whether it be an executable file,
  96.      an object file, an assembler file or preprocessed C code.
  97.      Since only one output file can be specified, it does not make
  98.      sense to use `-o' when compiling more than one input file, unless
  99.      you are producing an executable file as output.
  100.      If `-o' is not specified, the default is to put an executable file
  101.      in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its
  102.      assembler file in `SOURCE.s', and all preprocessed C source on
  103.      standard output.
  104.      Print (on standard error output) the commands executed to run the
  105.      stages of compilation.  Also print the version number of the
  106.      compiler driver program and of the preprocessor and the compiler
  107.      proper.
  108. `-pipe'
  109.      Use pipes rather than temporary files for communication between the
  110.      various stages of compilation.  This fails to work on some systems
  111.      where the assembler is unable to read from a pipe; but the GNU
  112.      assembler has no trouble.
  113. File: gcc.info,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  114. Compiling C++ Programs
  115. ======================
  116.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  117. or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  118. recognizes files with these names and compiles them as C++ programs
  119. even if you call the compiler the same way as for compiling C programs
  120. (usually with the name `gcc').
  121.    However, C++ programs often require class libraries as well as a
  122. compiler that understands the C++ language--and under some
  123. circumstances, you might want to compile programs from standard input,
  124. or otherwise without a suffix that flags them as C++ programs.  `g++'
  125. is a program that calls GNU CC with the default language set to C++,
  126. and automatically specifies linking against the GNU class library
  127. libg++.  (1) On many systems, the script `g++' is also installed with
  128. the name `c++'.
  129.    When you compile C++ programs, you may specify many of the same
  130. command-line options that you use for compiling programs in any
  131. language; or command-line options meaningful for C and related
  132. languages; or options that are meaningful only for C++ programs.  *Note
  133. Options Controlling C Dialect: C Dialect Options, for explanations of
  134. options for languages related to C.  *Note Options Controlling C++
  135. Dialect: C++ Dialect Options, for explanations of options that are
  136. meaningful only for C++ programs.
  137.    ---------- Footnotes ----------
  138.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  139. compiler.  That version was based on GNU CC, but not integrated with
  140. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  141. version 1.37 or 1.42--are much less reliable than the versions
  142. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  143. GCC will simply not work.
  144. File: gcc.info,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  145. Options Controlling C Dialect
  146. =============================
  147.    The following options control the dialect of C (or languages derived
  148. from C, such as C++ and Objective C) that the compiler accepts:
  149. `-ansi'
  150.      Support all ANSI standard C programs.
  151.      This turns off certain features of GNU C that are incompatible
  152.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  153.      predefined macros such as `u