The remainder of this chapter discusses the conventions used by the CC command, compiler source line directives, and other issues concerning the use of the compiler.
The general syntax of a compiler command line is as follows:
CC [options] [source-files] [object-files] [libraries]
An option is an option keyword prefixed by either a dash (–) or a plus sign (+). Some options take arguments.
In general, the processing of the compiler options is from left to right, allowing selective overriding of macro options (options that include other options). In most cases, if you specify the same option more than once, the rightmost assignment overrides and there is no accumulation. Note the following exceptions:
All linker options and the -features, –I -l,– L, -library, –pti, –R, -staticlib, -U, -verbose, -xdumpmacros, and -xprefetch options accumulate, they do not override.
All –U options are processed after all –D options.
Source files, object files, and libraries are compiled and linked in the order in which they appear on the command line.
In the following example, CC is used to compile two source files (growth.C and fft.C) to produce an executable file named growth with runtime debugging enabled:
example% CC -g -o growth growth.C fft.C
The suffix attached to a file name appearing on the command line determines how the compiler processes the file. A file name with a suffix other than those listed in the following table, or without a suffix, is passed to the linker.
|
The C++ compiler accepts multiple source files on the command line. A single source file compiled by the compiler, together with any files that it directly or indirectly includes, is referred to as a compilation unit . C++ treats each source as a separate compilation unit.