- cc - invoke the C or C++ compiler
- cc [ options ] [file ...]
- cc invokes an underlying C or C++ compiler and/or linker for building UWIN and/or native libraries and
applications. The underlying compiler can be the Microsoft Visual C/C++ compiler, the Digital Mars C/C++ compiler, the
Mingw Gnu compiler, or the Borland C/C++ builder compiler. To choose the Digital Mars compiler or the Borland compiler,
the PACKAGE_cc environment variable must be set to the top-level directory where the compiler is installed.
Except when invoked as ncc or pcc, the header file <astwin32.h> is automatically included
and the preprocessor symbol _UWIN is defined. The compiler can be invoked as one of the following:
- Invoke the underlying C/C++ compiler and/or linker as C.
- Invoke the underlying C/C++ compiler and/or linker as C++.
- Same as cc.
- Invoke the underlying compiler and/or linker but do not use UWIN headers or
libraries. This produces executables that do not require the UWIN runtime.
- Invoke the Microsoft Visual C/C++ compiler and/or linker with options for building
in the POSIX subsystem.
- Files with names ending in .c are taken to be C source programs unless the compiler has been invoked as CC
or BCC in which case they are taken to be C++ source programs. Files with names ending in .cc, .cpp
and .cxx are taken to be C++ source programs.
- When C and C++ programs are compiled the resulting object program is placed in the current directory. The object
file name is formed from the basename of the source file with the .c, .cc, .cxx or .cpp
suffix changed to .o. If more than one source file is specified, each source file name is written to standard
output before it is compiled.
- Other arguments refer to loader options, object programs, or object libraries. Unless -c, -S, -E
, or -P is specified, these programs and libraries, together with the results of any specified compilations
or assemblies, are loaded (in the order given) to produce an output file named a.out. You can specify a name for
the executable by using the -o option.
- By default, the underlying compiler is found by looking at registry keys. However, the environment variable PACKAGE_cc
can be set to the directory of the compiler root to override this.
- By default, the UWIN preprocessor found in /usr/lib/cpp is used. This can be overridden by exporting the
directory of the C preprocessor in the variable nativepp or by supplying the -Yp option which overrides
any nativepp setting. The underlying compilers preprocessor can be specified by exporting nativepp with a
value of -1.
- By default, the -g option produces code view debug information. The environment variable DEBUGTYPE
can be set to coff to produce symbol table information in coff format or to both to produce both coff
format and code view format.
- By default, the compiler builds .o's that link against the dynamic C library msvcrt. However, the -Bstatic
option can be specificed to build .o's for static linking with libc. In this case, -Bstatic
must also be specified on the link line.
- The behavior of the compiler can also be affected by the following arguments:
- This must be specified when building a dynamically linked library. It
will cause _DLL to be enabled.
- If defined then several BSD Unix interfaces are enabled. In
addition, signal(2), behaves with BSD semantics.
- The application will be linked as a gui application. The default is
a console application.
- Unlike most other commands, many of options are recognized as options no matter where they are on the command line.
As noted below, the behavior of some options depends on their position on the command line.
- -c, --compile
- Suppress linking with ld(1) and produce a .o file for each source
- -e, --entry=entry
- Passed to the linker to set the entry point for the program or
dynamically linked library.
- -g, --debug
- Produce additional symbol table information for debugging tools and pass option to ld(1).
When this option is given, the -O option is suppressed.
- -l, --library=library
- Link with object library library (for ld(1).)
This option must follow the sourcefile arguments. Library names are generated by first looking for library
.lib and then for liblibrary.a in each directory that it searches. If the -Bstatic
binding is in effect, the library.lib search is skipped. The behavior is affected by the location on the
- -m, --target=type
- Target specific control. type may be:
- -n, --show
- Do not execute the underlying compiler. Also enables -V.
- -o, --output=ofile
- Use the pathname ofile instead of the default a.out for
the executable or .o file produced.
- -s, --symtab
- Passed to ld(1) to enable symbol
table generation. On by default; -s means --nosymtab.
- -u, --unsatisfied=name
- Passed to the linker to make symbol name an unsatisfied
external symbol so that it will be searched for in a library.
- -v, --version
- Print the underlying compiler version string on the standard output and exit.
- -w, --warn
- Enable warning messages. On by default; -w means --nowarn.
- -B, --bind=binding
- binding can be one of the following, optionally preceded by no[-]
to indicate the inverse:
- Subsequent objects will be compiled with -D_DLL defined so that they
can be dynamically linked. This is the default.
- Objects will be compiled for statical linking.
- Passed to the linker.
- -C, --strip-comments
- Do not strip comments when pre-processing. This option requires the -E
or -P option also be specified. On by default; -C means --nostrip-comments.
- -D, --define=name[=val]
- Define name as if by a C-language #define directive.
If no def is given, name is defined as 1. If name is used with both -D and -U,
name will be undefined regardless of the order of the options.
- -E, --preprocess
- Run the source file through cpp(1),
the C preprocessor, only. Sends the output to the standard output, or to a file named with the -o option.
Includes the cpp line numbering information. (See also the -P option.)
- -G, --dynamic
- Generate a dynamically linked library.
- -I, --include=dir
- Add dir to the list of directories in which to search for #include
files with relative filenames (not beginning with slash `/'.) The preprocessor first searches for #include
files in the directory containing sourcefile, then in directories namer with -I options (if any),
then the /usr/include directory, and finally, the standard include directory provided by the underlying
compiler. When the compiler is invoked as ncc, /usr/include is not searched.
- -L, --libdir=dir
- Add dir to the list of directories containing object-library files
(for linking using ld(1).)
- -M, --generate=flag
- Generates dependency information. The flag value M causes
the information to be written to standard output. The flag value D causes the output to be written to a
file with the same name is the object file with the .o suffix replaced with .d.
- -O, --optimize
- Optimize the object code. Ignored when -g is used.
- Run the source file through cpp(1), the C
preprocessor, only. If the -o option is not specfied, the output will be written into a file with the same
basename and a .i suffix. Does not include cpp-type line number information in the output.
- -S, --assembly
- Produce an assembly source file with suffix .s and do not assemble it.
- -U, --undef=name
- Remove any initial definition of the cpp(1)
- -V, --verbose
- Show the command line(s) given to the underlying compiler. When used by itself,
without operands, -V prints the pathname of the underlying compiler directory.
- Set the warning level to level. A value of all set the warning level to
the highest level. The option value may be omitted. The default value is 3.
- -X, --specific
- Link for the compiler specific MSVCRNM.dll instead of the
- -Y [pass,]argument
- Pass the given argument to the compilation pass given by
pass. pass is c for the compiler, l for the linker, m is for the manifest generator,
and p for the preprocessor. If pass, is omitted then c, is assumed.
- Passed to the linker to add a symbol table.
- Run with administrator UAC.
- Delete --mt-input manifest after processing.
- Embed a manifest in the output executable if the underlying compilation system supports
- Manifest architecture type. The default value is *.
- Manifest application description.
- Manifest application language. The default value is neutral.
- Manifest company.product.application.
- Manifest application type. The default value is win32.
- Manifest application version. Must be of the form n.n.n.n. The default
value is yyyy.mm.dd.0.
- Use file instead of the default manifest.
- Save the default manifest in file and do not add it to the output.
- Executable output file.
- Library of object files.
- C source file.
- C++ source file.
- C++ source file.
- C++ source file.
- C++ source file.
- C source file after preprocessing with cpp(1).
- Assembler source file.
- Standard directory for #include files.
- All files compiled successfully.
- One or more files did not compile.
- ar(1), cpp(1),
cia(1), ld(1), m4(1),
- cc (AT&T Labs Research) 2010-02-02
- David Korn <firstname.lastname@example.org>
- Copyright © 1997-2010 AT&T Intellectual Property