JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: C++ User's Guide
search filter icon
search icon

Document Information


Part I C++ Compiler

1.  The C++ Compiler

2.  Using the C++ Compiler

2.1 Getting Started

2.2 Invoking the Compiler

2.2.1 Command Syntax

2.2.2 File Name Conventions

2.2.3 Using Multiple Source Files

2.3 Compiling With Different Compiler Versions

2.4 Compiling and Linking

2.4.1 Compile-Link Sequence

2.4.2 Separate Compiling and Linking

2.4.3 Consistent Compiling and Linking

2.4.4 Compiling for 64-Bit Memory Model

2.4.5 Compiler Command-Line Diagnostics

2.4.6 Understanding the Compiler Organization

2.5 Preprocessing Directives and Names

2.5.1 Pragmas

2.5.2 Macros With a Variable Number of Arguments

2.5.3 Predefined Names

2.5.4 Warnings and Errors

2.6 Memory Requirements

2.6.1 Swap Space Size

2.6.2 Increasing Swap Space

2.6.3 Control of Virtual Memory

2.6.4 Memory Requirements

2.7 Using the strip Command with C++ Objects

2.8 Simplifying Commands

2.8.1 Using Aliases Within the C Shell

2.8.2 Using CCFLAGS to Specify Compile Options

2.8.3 Using make Using CCFLAGS Within make

3.  Using the C++ Compiler Options

Part II Writing C++ Programs

4.  Language Extensions

5.  Program Organization

6.  Creating and Using Templates

7.  Compiling Templates

8.  Exception Handling

9.  Improving Program Performance

10.  Building Multithreaded Programs

Part III Libraries

11.  Using Libraries

12.  Using The C++ Standard Library

13.  Using the Classic iostream Library

14.  Using the Complex Arithmetic Library

15.  Building Libraries

Part IV Appendixes

A.  C++ Compiler Options

B.  Pragmas



2.8 Simplifying Commands

You can simplify complicated compiler commands by defining special shell aliases, using the CCFLAGS environment variable, or by using make.

2.8.1 Using Aliases Within the C Shell

The following example defines an alias for a command with frequently used options.

example% alias CCfx "CC -fast -xnolibmil"

The next example uses the alias CCfx.

example% CCfx any.C

The command CCfx is now the same as:

example% CC -fast -xnolibmil any.C

2.8.2 Using CCFLAGS to Specify Compile Options

You can specify options by setting the CCFLAGS variable.

The CCFLAGS variable can be used explicitly in the command line. The following example shows how to set CCFLAGS (C Shell):

 example% setenv CCFLAGS ’-xO2 -m64’

The next example uses CCFLAGS explicitly.

 example% CC $CCFLAGS

When you use make, if the CCFLAGS variable is set as in the preceding example and the makefile’s compilation rules are implicit, then invoking make will result in a compilation equivalent to:

CC -xO2 -m64 files...

2.8.3 Using make

The make utility is a very powerful program development tool that you can easily use with all Solaris Studio compilers. See the make(1S) man page for additional information. Using CCFLAGS Within make

When you are using the implicit compilation rules of the makefile (that is, there is no C++ compile line), the make program uses CCFLAGS automatically.