Different forms of the XL C/C++ compiler invocation commands support various levels of the C and C++ languages. In most cases, you should use the xlc command to compile your C source files, and the xlc++ command to compile C++ source files. Use xlc++ to link if you have both C and C++ object files.
You can use other forms of the command if your particular environment requires it. Table 1 lists the different basic commands, with the special versions of each basic command. Special commands are described in Table 2.
| Basic invocations | Description | Equivalent special invocations |
|---|---|---|
| xlc | Invokes the compiler for C source files. This command supports all of the ISO C99 standard features, and most IBM language extensions. This invocation is recommended for all applications. | xlc_r |
| c99 | Invokes the compiler for C source files. This command supports all ISO C99 language features, but does not support IBM language extensions. Use this invocation for strict conformance to the C99 standard. | c99_r |
| c89 | Invokes the compiler for C source files. This command supports all ANSI C89 language features, but does not support IBM language extensions. Use this invocation for strict conformance to the C89 standard. | c89_r |
| cc | Invokes the compiler for C source files. This command supports pre-ANSI C, and many common language extensions. You can use this command to compile legacy code that does not conform to standard C. | cc_r |
| gxlc | Invokes the compiler for C source files. This command accepts many common GNU C options, maps them to their XL C option equivalents, and then invokes xlc. For more information, refer to Reusing GNU C/C++ compiler options with gxlc and gxlc++. | |
| xlc++, xlC | Invokes the compiler for
C++ source files. If any of your source files are C++, you
must use this invocation to link with the correct runtime libraries.
Files with .c suffixes, assuming you have not used the -+ compiler option, are compiled as C language source code. |
xlc++_r, xlC_r |
| gxlc++, gxlC | Invokes the compiler for C++ files. This command accepts many common GNU C/C++ options, maps them to their XL C/C++ option equivalents, and then invokes xlc++. For more information, refer to Reusing GNU C/C++ compiler options with gxlc and gxlc++. |