{ cc
| c11
| CC
} { option | operand } ...
or
The differences between the cc
, c11
, c89
and CC
commands are summarized below.
The cc, c11, c89 and CC commands
cc
If the compiler is called with cc
, it works as a C compiler, and the default language mode is set to the latest supported C language mode. In this version of the compiler this mode is C11 (see the -X 2011
option in section "Options for selecting the language mode)").
Options and operands may be specified in any order on the command line.
In contrast to the c89
command, -L
dir is interpreted as an operand (see option -L and the --
option in section "General options").
c11
If the compiler is called with c11
, it works as a C compiler, and the default language mode is set to C11 (see the -X 2011
option in section "Options for selecting the language mode").
Options and operands may be specified in any order on the command line.
In contrast to the c89
command, -L
dir is interpreted as an operand (see option -L and the --
option in section "General options").
c89
If the compiler is called with c89
, it works as a C compiler, and the default language mode is set to C89 (see the -X 89
option in section "Options for selecting the language mode").
In this case, options and operands cannot be mixed on the command line, i.e. the "options before operands" sequence must be maintained.
In contrast to the cc/CC
commands, -L
dir is interpreted here as an option (see option -L and the --
option in section "General options").).
CC
If the compiler is called with CC
, it works as a C++ compiler, and the default language mode is set to the latest supported C++ language mode. In this version of the compiler this mode is C++ 2020 (see the -X 2020
option in section "Options for selecting the language mode)").
Options and operands may be specified in any order on the command line.
In contrast to the c89
command, -L
dir is interpreted as an operand (see option -L and the --
option in section "General options").
Options
No option specified
If the source code contains no syntax errors, and all unresolved references are resolved, the compiler generates an executable file a.out
, which contains the executable program.
The compiler only stores the object code of the separate source files in .o
files with the same names if at least two source files or one source file and one (.o
) object file are specified.
If only a source file file.c is specified, no object file file.o is available after compilation as it is a temporary file and is subsequently deleted. If an object file file.o exists before compilation, this is also deleted.
option
You can specify options in the compiler call to control the compilation process and to determine which arguments are passed to the programs for the individual compilation phases.
Options can also be used to instruct the compiler to perform only some of the compilation phases (see "Options for selecting compilation phases"). If the compilation process is not completed fully, all options that refer to the skipped compilation phases are ignored by the compiler. If multiple options are used to select the compilation phases to be performed, the compiler will stop after the earliest specified phase.
An option always consists of a single letter that is identified by a leading hyphen ("-").
Multiple options may be grouped, i.e. specified in succession after a single hyphen without any delimiting whitespace, only if none of the listed options take any arguments (e.g. -V -c
could also be entered as -Vc
).
Options that take arguments must be specified in accordance with the XPG4 Standard by separating the option and its argument with a space. This XPG4-compliant notation is strongly recommended, but is not enforced by the compiler for compatibility reasons (e.g. the compiler will accept -ohello
instead of -o hello
).
Arguments that contain delimiters (:
or ,
) or the equals sign (=
) must not be specified with any whitespace before or after these characters.
Examples
-D MAKRO = 1 illegal -D MAKRO=1 legal -R limit, 20 illegal -R limit,20 legal
If the same option is specified more than once with conflicting arguments (e.g. -K at
and -K no_at
), the last option specified on the command line applies.
Options that are not known to the compiler, i.e. options that begin with an unrecognized letter after the leading hyphen ("-"), are ignored. A corresponding warning is issued. If the unknown option and the argument are separated by whitespace, the option is interpreted as an option without an argument.
Options with unrecognized arguments are ignored, and a corresponding warning is issued.
Special input rules for the -K
option
-K
arg1[,arg2...]
The -K
option can be used to specify one or more arguments in succession, with a delimiting comma between each such argument. The delimiter between the arguments (i.e. the comma) must not be preceded or followed by any whitespace.Multiple -K
options with one argument each have the same effect as a single -K
option with multiple arguments delimited by commas. The arguments specified with the -K
option may be entered in uppercase and/or lowercase letters (e.g. the arguments PIC
, pic
, Pic
, etc. are equivalent). In the case of conflicting specifications (e.g. -K uchar
and -K schar
), the last entry is taken without issuing a warning.
Operands
The "operands" category includes the following entries:
the names of input files, i.e.: file.suffix
the link editor options
-l
x and-lBLSLIB
only for the
cc/c11
/CC
commands: also the link editor option-L
dirThe compiler processes all options first, and then the operands, in the order in which they are specified on the command line.
All arguments that follow the--
option (which ends the input of options) on the command line are interpreted as operands, even if they begin with a "-" character (see the--
option in section "General options").
file.suffix
The name of an input file.
The compiler determines the contents of a file, and thus the compilation steps to be performed in each case, from the file name extension. The file name must therefore have a suffix (or extension) that matches its contents. The possible suffixes that can be used to identify source files will depend on the mode in which the compiler is invoked and whether the compiler was called with the cc
/c11
/c89
command (C mode) or with CC
(C++ mode).
The following suffixes are interpreted in individual cases as listed below:
| C source code ( |
| |
C++ source code before the preprocessor run ( | |
| C source code ( |
| C++ source code after the preprocessor run ( |
| Object file |
| Static library with object modules created with the |
In addition to the suffixes above, the -Y F
option may be used to specify other user defined suffixes, which are then recognized by the individual compiler components (see "General options").
File names with no suffix or an unrecognized suffix are passed through to the link editor without issuing a warning.
At least one input file (file.
suffix) or one library in the form -l x
is required for each compiler call.
If more than one input file is specified, these files need not be of the same type, i.e. source files and object files may all be specified in the same compiler call. In the case of object files and libraries, the order and position in which they are entered on the command line are significant for linking.
-L
dir
-L
dir is only interpreted as an operand when the compiler is called with the cc
, c11
and CC
commands. dir can be used to specify an additional directory that is to be searched by the link editor for the libraries specified with the -l
option (see "Link editor options" for more details).
-l
x
This operand instructs the link editor to search for libraries named lib
x.a
(see “Link editor options” for more details).
-l BLSLIB
This operand instructs the link editor to search through PLAM libraries which were assigned with the BLSLIBnn shell environment variable (00 >=
nn <=
99) (see “Link editor options” for more details).
Exit status
0 | Normal termination of the compiler run; no errors, but possibly with notes and warnings |
1 | Normal termination of the compiler run; with error |
2 | Abnormal termination of the compiler run; with the occurrence of a fatal error |