Sun Studio 12 Update 1: C++ User's Guide

2.2.1 Command Syntax

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:

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