Invoking the compiler

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.

All the invocation commands can be used to link programs that use multithreading. The _r versions of invocation commands are for backward compatibility only.

Note: For each invocation command, the compiler configuration file defines default option settings and, in some cases, macros; for information about the defaults implied by a particular invocation, see the /opt/ibm/xlC/13.1.6/etc/xlc.cfg.$OSRelease.gcc$gccVersion file for your system.
Examples of the default configuration file are listed below:
  • /opt/ibm/xlC/13.1.6/etc/xlc.cfg.sles.12.gcc.4.8.2
  • /opt/ibm/xlC/13.1.6/etc/xlc.cfg.rhel.7.3.gcc.4.8.5
  • /opt/ibm/xlC/13.1.6/etc/xlc.cfg.centos.7.gcc.4.8.5
  • /opt/ibm/xlC/13.1.6/etc/xlc.cfg.ubuntu.16.04.gcc.4.8.2
Table 1. Compiler invocations
Invocations Description Equivalent 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
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

Related information



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us