The xlc utility provides two basic compiler invocation commands, xlc and xlC (xlc++),
along with several other compiler invocation commands to support various
C/C++ language levels and compilation environments. In most cases,
you would use the xlc command to compile C source
files and xlC (xlc++) command
to compile C++ source files.
You can however, use other forms of the command if your particular
environment requires it. The various compiler invocation commands
for C are:
- xlc
- cc
- c89
- c99
- xlc_x
- cc_x
- c89_x
- c99_x
- xlc_64
- cc_64
- c89_64
- c99_64
The various compiler invocation commands for C++ are:
- xlC (xlc++)
- cxx
- c++
- xlC_x (xlc++_x)
- c++_x
- cxx_x
- xlC_64 (xlc++_64)
- c++_64
- cxx_64
The two basic compiler invocation commands appear as the first
entry of each of these list items. Select an invocation command using
the following criteria:
- xlc
- Invokes the compiler for C source files with a default language
level of ANSI, the compiler option -qansialias to
allow type-based aliasing, and the compiler option -qcpluscmt to
allow C++ style comments (//).
- xlC (xlc++)
- Invokes the compiler so that source files are compiled as C++
language source code.
Files with .c suffixes, assuming you have
not used the -+ compiler option, are compiled as
C language source code with a default language level of ANSI, and
compiler option -qansialias to allow type-based
aliasing.
If any of your source files are C++, you must use
this invocation to link with the correct runtime libraries.
- cc
- Invokes the compiler for C source files with a default language
level of extended and compiler options -qnoro and -qnoroconst (to
provide placement of string literals or constant values in read/write
storage).
Use this invocation for legacy C code that does not require
compliance with ANSI C. This invocation is intended to provide the
same compiler behavior as when invoked by the cc command
name of the c89 utility.
- c89
- Invokes the compiler for C source files, with a default language
level of ANSI, and specifies compiler options -qansialias (to
allow type-based aliasing) and -qnolonglong (disabling
use of long long). Use this invocation for strict conformance to the ISO/IEC
9899:1990 standard. This invocation is intended to provide the
same compiler behavior as when invoked by the c89 command
name of the c89 utility.
- c99
- Invokes the compiler for C source files, with a default language
level of STDC99 and specifies compiler option -qansialias (to
allow type-based aliasing). Use this invocation for strict conformance
to the ISO/IEC 9899:1999 standard.
- cxx/c++
- The cxx and c++ commands
invoke the compiler for C++ language source code. Both are intended
to provide the same compiler behavior as when invoked using the cxx and c++ command
names of the c89 utility.
You can combine the previously described command names with the
following suffixes:
- _x
- Command invocations using command names with suffix _x are
the same as invocations using names without suffixes, except the -qxplink option
is also specified and appropriate XPLINK libraries are used in the
link step. If you are building an XPLINK application, you no longer
need to use command names with suffix _x to
link with the correct runtime libraries. This can be achieved
through the new configuration attributes that have been introduced
to enable XPLINK behavior without the use of suffixes. See Configuration file attributes for further information.
- _64
- Command invocations using command names with suffix _64 are
the same as invocations using names without suffixes, except the -q64 option
is also specified and appropriate 64-bit libraries are used in the
link step. If you are building a 64-bit application, you no longer
need to use command names with suffix _64 to
link with the correct runtime libraries. This can be achieved
through the new configuration attributes that have been introduced
to enable 64-bit behavior without the use of suffixes. See Configuration file attributes for further information.
Notes: - Suffixes are used as a naming convention and do not enforce behavior. The
content of the command line will take precedence over the suffixes.
- When compiling and linking a C++ application using a single command
line invocation, the application will be correctly link edited with
any stanza if at least one C++ source file is specified on the command
line. If only object files or a mix of C sources and C++ object files
are specified on the command line, a C++ stanza must be used to correctly
link edit the application.