Specifying compiler options

Compiler options perform a variety of functions, such as setting compiler characteristics, describing the object code to be produced, controlling the diagnostic messages emitted, and performing some preprocessor functions.

You can specify compiler options:
  • On the command-line with command-line compiler options
  • In your source code using directive statements
  • In a makefile
  • In the stanzas found in a compiler configuration file
  • Or by using any combination of these techniques
It is possible for option conflicts and incompatibilities to occur when multiple compiler options are specified. To resolve these conflicts in a consistent fashion, the compiler usually applies the following general priority sequence to most options:
  1. Directive statements in your source file override command-line settings
  2. Command-line compiler option settings override configuration file settings
  3. Configuration file settings override default settings
Generally, if the same compiler option is specified more than once on a command-line when invoking the compiler, the last option specified prevails.
Note: Some compiler options do not follow the priority sequence described above.

For example, the -I compiler option is a special case. The compiler searches any directories specified with -I in the vac.cfg file before it searches the directories specified with -I on the command-line. The option is cumulative rather than preemptive.

See the XL C/C++ Compiler Reference for more information about compiler options and their usage.

Other options with cumulative behavior are -R and -l (lowercase L).

You can also pass compiler options to the linker, assembler, and preprocessor. See Compiler options reference for more information about compiler options and how to specify them.