CC(1) — UNIX Programmer’s Manual
NAME
cc − C compiler
SYNOPSIS
cc [ option ] ... file ...
DESCRIPTION
cc is the UNIX C compiler.
cc accepts several types of arguments:
Arguments whose names end with ’.c’ are taken to be C source programs; they are compiled, and each object program is left on the file whose name is that of the source with ’.o’ substituted for ’.c’. The ’.o’ file is normally deleted, however, if a single C program is compiled and loaded all at one go.
In the same way, arguments whose names end with ’.s’ are taken to be assembly source programs and are assembled, producing a ’.o’ file.
The following options are interpreted by cc. See ld(1) for load-time options.
−c Suppress the loading phase of the compilation, and force an object file to be produced even if only one program is compiled.
−n Passed on to ld to make the text of the resulting program shared.
−p Arrange for the compiler to produce code which counts the number of times each routine is called; also, if loading takes place, replace the standard startup routine by one which automatically calls monitor(3) at the start and arranges to write out a mon.out file at normal termination of execution of the object program. An execution profile can then be generated by use of prof(1).
−O Invoke an object-code improver (optimizer).
−R(addr)
Passed on to ld, making the resulting object module origined at addr(hex).
−S Compile the named C programs, and leave the assembler-language output on corresponding files suffixed ’.s’.
−P Run only the macro preprocessor on the named C programs, and send the result to the corresponding files suffixed. ’.l’
−C prevent the macro preprocessor from eliding (leaving out) comments.
−o output
Name the final output file output. If this option is used the file ’a.out’ will be left undisturbed.
−Dname=def
−Dname
Define the name to the preprocessor, as if by "#define". If no definition is given, the name is defined as "1".
−Uname
Remove any initial definition of name.
−Idir "#include" files whose names do not begin with ’/’ are always sought first in the directory of the file argument, then in directories named in −I options, then in directories on a standard list.
Other arguments are taken to be either loader option arguments, or C-compatible object programs, typically produced by an earlier cc run, or perhaps libraries of C-compatible routines. These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name a.out.
EXAMPLE
cc -o output prog1.c prog2.c prog3.c
would compile code in the three named C programs and put the compiled code into the file output.
FILES
file.cinput file
file.oobject file
a.outloaded output
/tmp/ctm?temporary
/lib/cpppreprocessor
/lib/cocompiler pass1
/lib/c1 compiler pass2
/lib/c2optional optimizer
/lib/crt0.oruntime startoff
/lib/mcrt0.ostartoff for profiling
/lib/libc.astandard library, see section 3
/usr/includestandard directory for ’#include’ files
SEE ALSO
monitor(3), prof(1), adb(1), ld(1), sdb(1), old(8) B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978
B. W. Kernighan, Programming in C—a tutorial
D. M. Ritchie, C Reference Manual
DIAGNOSTICS
The diagnostics produced by C itself are intended to be self-explanatory. Occasional messages may be produced by the assembler or loader.
7th Edition — 1/5/82