cc - C compiler
             cc [options] file . . .
             The cc command is the interface to the C compilation system.
             The compilation system consists of the following conceptual
             phases: preprocessing, compiling, optimizing, basic block
             profiling, assembling, and linking.  The cc command examines
             its options and filename suffixes, and then executes the
             proper phases with appropriate options and arguments.
             The cc command recognizes the following filename suffixes:
             .c    A file that contains unprocessed C source; all phases
                   are applicable.
             .i    A file that contains preprocessed C source; all phases
                   except for preprocessing are applicable.
             .s    A file that contains assembly language source; only the
                   assembling and linking phases are applicable.
             other A file that contains input applicable only to the
                   linking phase.  This category commonly includes object
                   files (.o), archive libraries (.a), and shared object
                   libraries (.so).
             If no options are present, the cc command sends all files
             through those phases (as appropriate to their suffixes) as are
             necessary to combine them into a dynamically linked executable
             with the name a.out in the current directory.  If an
             intermediate result is requested instead, it is similarly
             placed in the current directory, with a filename derived by
             replacing the incoming suffix with a suffix appropriate to the
             resultant file.  If the assembling phase occurs, the cc
             command places the object file (.o) in the current directory,
             but this file will be removed if a single source file is being
             compiled through to an executable.  All other intermediate
             files are placed in a temporary directory.  (The choice of
             directory can be controlled with the environment variable
             An exception to the filename suffix rule is that any file
             name, regardless of suffix, will be accepted with the -E
             option.  This allows the C preprocessor to be invoked as a
             standalone tool for use with non-C source files.
             The following options are applicable to all phases.
             -Q str  Controls the inclusion of compilation tool
                     identification information in the output.  If str is y
                     (the default), then the information will be present;
                     if str is n, it will not.
             -V      Causes the cc command and each invoked tool to print
                     its version information, one per line, on the standard
                     error output.
             -W phase,list
                     Hands the argument(s) specified by the comma-separated
                     list (in order) to the single compilation phase named
                     by phase.  An argument in list can include a comma by
                     escaping it by a preceding \.  If more than one
                     conceptual phase is implemented by a single tool, all
                     the associated argument lists are passed to the tool.
                     The phase names are the following:
                     p  preprocessor
                     0  compiler
                     2  optimizer
                     b  basic block profiler
                     a  assembler
                     l  linker
                     Relative to the regular options and arguments passed
                     to the compilation phase, the location of the
                     arguments specified by list is unspecified and may
             -X str  Controls the degree of conformance to the ANSI and ISO
                     C standards.  The option argument str can be one of
                     the following:
                     a  Specifies standards conformance except that some
                        required warnings are omitted and the name space is
                        expanded to include names that are not specified by
                        the standards.  All C constructions behave as
                        specified in the standards.  All implemented
                        language and library extensions beyond the
                        standards are also available.  This is the default.
                     c  Specifies strict standards conformance.  Because
                        the name space of the language and headers is
                        reduced from that of -Xa, certain extensions (such
                        as the asm keyword) and some commonly expected
                        header file declarations are not available.  The
                        latter may be helped by use of -D_POSIX_SOURCE or
                     t  Specifies standards conformance except where the
                        semantics differ from ``classic'' C.  (See
                        Kernighan & Ritchie, First Edition.)  In addition,
                        warnings are issued about preprocessing phase
                        semantic changes such as new escape sequences (like
                        \x) and any trigraph replacements (like ??!).
                        Certain potential optimizations available in the
                        other -X modes are also disabled.
                     In all -X modes, the compiling phase will warn about
                     expressions in which the modified promotion rules for
                     narrower unsigned values may cause an otherwise hidden
                     behavior change.
             -Y str,dir
                     Uses the directory dir to find the item(s) named by
                     str.  The option argument str is one or more of the
                     phase Causes the phase (spelled the same as for -W) to
                           be found in the directory dir.  If more than one
                           conceptual phase is implemented by a single tool
                           and differing directories are specified for the
                           phases, it is unspecified which directory is
                     I     Changes the directory searched last for
                           preprocessing phase include files.
                     P     Changes the linking phase default library search
                           path to be the colon-separated list of one or
                           more directories, dir.  (More directories can be
                           added to the front of the path due to other
                    S     Changes the directory in which to find the
                          implementation's start-up object files.
                    In addition to the ability to specify the directory in
                    which to find the various compilation phases, if the
                    cc command is invoked as prefixcc, then each tool
                    executed will be similarly prefixed, as will the
                    filenames for the start-up object files.  For example,
                    if the command .⁄abccc is invoked with -Ya,..⁄xyz,
                    then the assembler would be expected to have the
                    pathname ..⁄xyz⁄abcas.
            The following options are applicable only to the preprocessing
            phase.  During this phase, the macros _ _STDC_ _ and _ _USLC_
            _ are always predefined.  While
            _ _USLC_ _ always has a positive integer value (which
            signifies that a USL C compilation system is being used), _
            _STDC_ _ has the value 1 only for -Xc, and the value 0
            -A name[(tokens)]
                    Causes name to be asserted as a predicate associated
                    with the optional parenthesized tokens as if by a
                    #assert directive.
            -A -    Causes all predefined macros (other than those that
                    begin with __) to be undefined and all preassertions
                    to be unasserted.
                    The affected predefined macros and preassertions are
                    the following:
                          #define i386 1       ⁄* not present if -Xc *⁄
                          #define unix 1       ⁄* not present if -Xc *⁄
                          #assert system(unix)
                          #assert cpu(i386)
                          #assert machine(i386)
            -C      Causes all comments other than on directive lines to
                    be retained in the output of the preprocessor phase;
                    otherwise, they are removed.
            -D name[=tokens]
                    Causes name to be defined as a macro to be replaced by
                    tokens, or by 1 if =tokens is not present, as if by a
                    #define directive.
             -E      Suppresses all phases but preprocessing, and sends the
                     result to the standard output.  The result will
                     contain lines similar to preprocessing directives and
                     can be used for a subsequent compiling phase.  The
                     name of the file being preprocessed may have any
             -H      Causes the pathnames of all files included to be
                     printed, one per line, on the standard error output.
             -I dir  Causes dir to be searched for included files whose
                     names do not begin with ⁄ before searching the usual
                     directories.  The directories for multiple -I options
                     are searched in the order specified.
             -P      Suppresses all phases but preprocessing, and places
                     the result in a .i-suffixed file.  Unlike -E, the
                     result will contain no directives.  Compiling this
                     resultant .i file produces an executable whose line
                     numbers match the .i file instead of the .c file.
             -U name Causes name to be undefined as a macro as if by a
                     #undef directive, even if name is a predefined macro
                     (including those that begin with __) or is also the
                     subject of a -D option.
             The following options are applicable to all phases except the
             preprocessing phase.  All options affecting only the linking
             phase are also handed to the ld(1) command.
             -B str  Controls the linking phase library name search
                     mechanism for subsequent -l options.  The option
                     argument str can be either dynamic (the initial
                     setting) or static.  The order of the -B, -L, and -l
                     options is significant; see the -l option.
             -c      Suppresses the linking phase.  No produced object
                     files (.o) are removed.
             -d str  Determines the mode of the executable result of the
                     linking phase.  If str is y (the default), a
                     dynamically linked executable is to be produced; if
                     str is n, the result will be statically linked.
             -G      Causes the linking phase to produce a shared object
                     instead of an executable.
             -g      Causes the generation of information that facilitates
                     symbolic debugging.  This option clashes with -O but
                     has lower precedence: no debugging information is
                     generated if both are specified.
             -K list Enables certain variations in code generation, or
                     optimization, or linking, or a combination thereof.
                     For those items in the following list presented in
                     groups of two or more, the first item is the default
                     choice, and at most one of each such group will be
                     effective.  The option argument list is a comma-
                     separated list of one or more of the following items:
                     PIC     Changes code generation to be position-
                     thread  Specifies whether the program will use the
                             multi-threading facilities.  In threaded mode,
                             arranges for the appropriate preprocessor
                             flags to be turned on and for the threading
                             library to be linked in the correct order.
                     i386    Causes code generation specifically tuned to
                             the selected Intel microprocessor.  blended
                             (the default) balances the code generation
                             choices to work well on all these processors.
                             Used only in conjunction with -O.
                     no_ieee Controls whether the generated floating point
                             code strictly conforms to the IEEE floating
                             point and C standards.  ieee specifies strict
                             conformance.  no_ieee permits more aggressive
                             floating point optimization.  It assumes that
                             the application does not change rounding
                             modes, does not check for exception
                             conditions, and does not produce NaNs or
                             infinities.  In this mode, errno might not be
                             set as often and exceptions may not be raised.
                     frame   Specifies the stack frame layout strategy the
                             compiler is permitted to use.  frame uses the
                             %ebp register as a dedicated stack frame
                             pointer.  fixed_frame and no_frame represent
                             alternate stack layouts: both permit %ebp to
                             be allocated as a general purpose register,
                             which usually produces faster code, but in
                             rare instances may cause debugging stack
                             traces to fail.  Between the two, fixed_frame
                             saves instructions at the expense of stack
                             space, while no_frame does the reverse.
                             fixed_frame is advantageous for the Intel P6
                             processor architecture, and is the default
                             when -Kp6 is specified.  Otherwise, no_frame
                             is the default.  This option only applies when
                             the -O option is specified; unoptimized code
                             always uses the frame pointer layout.
                             Specifies whether the compiler may perform
                             argument passing in registers, which produces
                             faster code.  This is done for certain types
                             of calls within a translation unit, and only
                             when -O is specified.  A consequence of this
                             option is that function breakpointing in
                             debugging, and argument information in
                             debugging stack traces, may be unreliable. -
                             Kargs_in_regs clashes with inlining but has
                             lower precedence; no argument passing in
                             registers is done if both are specified.
                     no_host In hosted mode, the compiler assumes that
                             function names in the C standards are reserved
                             and behave as described by the standard.  The
                             compiler will be free to inline such functions
                             if requested.  If no_ieee is also specified,
                             the compiler assumes that math functions do
                             not have NaNs or infinities as arguments and
                             do not produce NaNs or infinities.
                     inline  Specifies whether the compiler should perform
                             function inlining.  Inlining may yield better
                             execution speed at the expense of extra code
                             size.  Only applies if the -O option is
                             Specifies whether the compiler performs loop
                             unrolling when optimization is enabled (-O).
                             Loop unrolling may yield better execution
                             speed at the expense of extra code size.
                     uchar   Specifies whether plain character types are
                             considered signed or unsigned.  The default is
                     Multiple -K options have the same effect as if the
                     separate list arguments were merged into one option.
             -L dir  Adds dir to the linking phase list of directories to
                     be searched for subsequent -l options.  The order of
                     the -B, -L, and -l options is significant; see the -l
             -l str  Causes the linking phase to search the library
            or libstr.a.  The order of the -B, -L, and
                     -l options is significant: A -l option causes the
                     linker to check first in the directories specified by
                     preceding -L options (in order) and then in the
                     directories of the default library search path (-YP).
                     If -Bdynamic is set at the point of the -l option,
                     each directory is checked first for and then
                     libstr.a; otherwise, only libstr.a is checked.
             -O      Enables the optimization phase.  This phase clashes
                     with -g but has higher precedence: no debugging
                     information is generated if both are specified.  This
                     phase also clashes with -ql but has lower precedence:
                     the optimization phase is disabled if both are
             -o str  Causes the linking phase to place its result in str
                     instead of a.out.
             -p      Causes extra code to be generated that counts the
                     number of calls to each routine.  If the linking phase
                     is enabled, the default library search path (-YP) is
                     altered to check directories that are intended to
                     contain similarly instrumented libraries before the
                     usual directories.  Moreover, different start-up
                     object files are used that arrange to record (in the
                     file mon.out) the time spent in each routine; see
             -q str  Causes extra code that instruments the program to be
                     generated.  If str is p, the behavior is the same as
                     the -p option.  If str is l, the basic block profiling
                     phase is enabled which generates extra code that
                     counts the number of times each source line is
                     executed; see lprof(1).  If str is f, a flow profile
                     log is created; see fprof(1).  The -O option clashes
                     with -ql but has lower precedence: the optimization
                     phase is not enabled if both are specified.
             -S      Suppresses the assembling and linking phases, and
                     produces an assembly file (.s-suffixed file).
             -v      Causes the compiling phase to perform extra syntactic,
                     semantic, and lint(1)-like checks.
             -Z str  Controls the packing of structures in the compiling
                     phase.  The option argument str is one of the
                     p1  Selects at least one byte alignment for all
                         structure members; or, in other words, include no
                         padding.  (This can also be specified as -Zp.)
                     p2  Selects at least two byte alignment for structure
                         members of at least two bytes in size.
                     p4  Selects two byte alignment for two byte sized
                         structure members and four byte alignment for
                         larger structure members.  This is the default
             The cc command recognizes -e, -h, -u, and -z as linking phase
             options with arguments.  These, and all other unrecognized
             option-like arguments are handed to ld(1).
             Finally, the cc command also recognizes the option -#.  If one
             -# option is present, the cc command will print each tool with
             its options and argument just before it is invoked.  With two
             -# options, the pathname of each tool is also printed; with
             three, the invocations are skipped.
             a.out          default name of resulting executable
             INCDIR         last directory to search for include files
             LIBDIR⁄*crt*.o startup code object files
             LIBDIR⁄acomp   preprocessor and compiler
             LIBDIR⁄optim   optimizer
                            basic block profiler
             BINDIR⁄as      assembler
             BINDIR⁄ld      linker
             LIBDIR⁄ dynamic shared standard C library
             LIBDIR⁄libc.a  archive standard C library
             DIR⁄libp       subdirectory of each LIBPATH entry in which to
                            check for profiled libraries
             INCDIR         usually ⁄usr⁄include
             LIBDIR         usually ⁄usr⁄ccs⁄lib
             BINDIR         usually ⁄usr⁄ccs⁄bin
             LIBPATH        usually ⁄usr⁄ccs⁄lib:⁄usr⁄lib
             TMPDIR         usually ⁄var⁄tmp but can be overridden by the
                            environment variable TMPDIR.
                            language-specific message file [See LANG on
             as(1), debug(1), ld(1), lint(1), lprof(1), monitor(3C),
             prof(1), tmpnam(3S)
             Kernighan, B. W., and Ritchie, D. M., The C Programming
             Language, Second Edition, Prentice-Hall, 1988
             American National Standard for Information Systems -
             Programming Language C, X3.159-1989
             International Standard ISO⁄IEC 9899:1990, Programming
             Languages - C
             International Standard ISO⁄IEC 9945-1:1990, Information
             Technology - Portable Operating System Interface (POSIX) -
             Part 1: System Application Program Interface (API) [C
             If a mode choice option (such as -Q or -X) is specified more
             than once, generally the last is used.
             New code should use -Xa, -Khost and -v; old code is probably
             best handled with -Xt and -Kno_host.
             For a typical multiuser Intel486 microprocessor-based system,
             the fastest code will probably be generated by using the -Xa,
             -Kno_ieee, -Kinline, and -O options, and by using the standard
             include files such as <string.h>.
Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 227 of 485)
Comments, flames, broken links?
Please send email to