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, in a configuration file, in your source code, or any combination of these techniques. Most options that are not explicitly set take the default settings.
When multiple compiler options have been specified, it is possible for option conflicts and incompatibilities to occur. To resolve these conflicts in a consistent fashion, the compiler applies the following priority sequence unless otherwise specified:
Generally, among multiple command-line options, the last specified prevails.
Other options with cumulative behavior are -R and -l (lowercase L).
Related References
XL C/C++ uses a five-level classification scheme for diagnostic
messages. Each level of severity is associated with a compiler
response. Not every error halts compilation. The following table
provides a key to the abbreviations for the severity levels and the associated
compiler response.
Severity levels and compiler response | ||
Letter | Severity | Compiler Response |
---|---|---|
I | Informational | Compilation continues. The message reports conditions found during compilation. |
W | Warning | Compilation continues. The message reports valid, possibly unintended conditions. |
![]() | Error | Compilation continues and object code is generated. Error conditions exist that the compiler can correct, but the program might not produce the expected results. |
S | Severe error | Compilation continues, but object code is not generated. Error conditions exist that the compiler cannot correct. |
U | Unrecoverable error | The compiler halts. An unrecoverable error has been encountered. If the message indicates a resource limit (for example, file system full or paging space full), provide additional resources and recompile. If it indicates that different compiler options are needed, recompile using them. If the message indicates an internal compiler error, the message should be reported to your IBM service representative. |
The default behavior of the compiler is to compile with the option -qnoinfo or -qinfo=noall. The suboptions for -qinfo provide the ability to specify a particular category of informational diagnostics. For example, -qinfo=por limits the output to those messages related to portability issues.
At the end of compilation, the compiler sets the return code to zero under any of the following conditions:
Otherwise, the compiler sets one of the return codes documented in XL C/C++ Compiler Reference.
Related References
By default, diagnostic messages have the following format:
"file", line line_number.column_number: 15cc-nnn (severity) message_text.
where 15 is the compiler product identifier, cc is a two-digit code indicating the compiler component that issued the message, nnn is the message number, and severity is the letter of the severity level. The possible values for cc are:
This format is the same as compiling with the -qnosrcmsg option enabled. To get an alternate message format in which the source line displays with the diagnostic message, try compiling with -qsrcmsg option. Enabling this option instructs the compiler to print to standard error the source line where the compiler thinks the error lies; a second line below it, whenever possible, that points to a specific point in that source line; and the diagnostic message.
Related References
This page features options that are basic to using the compiler on the Linux platform.
See XL C/C++ Compiler Reference for more information.
Selected compiler options specific to the Linux platform | |
Option name | Description |
---|---|
-qgcc_c_stdinc=<paths> | Specifies the directory search paths for the GNU C headers. |
-qgcc_cpp_stdinc=<paths> | Specifies the directory search paths for the GNU C++ headers. |
-qc_stdinc=<paths> | Specifies the directory search paths for the IBM C headers. |
-qcpp_stdinc=<paths> | Specifies the directory search paths for the IBM C++ headers. |
The following options provide specialized control of directory search
paths. The options are cumulative, rather than preemptive. The
paths specified on the command line with the options -L,
-R, and -l (lowercase L) will have lower
priority at link time than those specified as an option in the configuration
file, but higher priority than paths specified as an attribute in the
configuration file.
Selected path control options | |
Option name | Description |
---|---|
-I | Specifies additional directory paths to be searched for #include files. |
-l | Specifies the shared library or archive file for static linking. |
-L | Specifies the library search paths to be searched at link time. |
-R | Specifies the directory paths to be searched at run time for dynamically loaded libraries. |
Related References