Oracle® Solaris Studio 12.4: Overview

Exit Print View

Updated: December 2014
 
 

C Compiler

The Oracle Solaris Studio C compiler conforms to the ISO/IEC 9899:1999, Programming Language - C and ISO/IEC 9899:1990, Programming Languages-C standards, and some of the Programming Language - C and ISO/IEC 9899:2011 standard. The C compiler also supports the OpenMP 4.0 shared-memory parallelism API.

The C compilation system consists of a compiler, an assembler, and a linker. The cc command invokes each of these components automatically unless you use command-line options to perform the steps separately.

cc Command Syntax

The syntax of the cc command is:

cc [compiler-options] source-files [-Ldir] [-llibrary]...

You can type cc -flags to see short descriptions of all the possible compiler options.

The source file names can end in .c, .s, .S, or .i. Files whose names do not end in one of these suffixes are passed to the link editor.

Following the source file names, you can optionally specify the –Ldir option to add directories to the list that the linker searches for libraries, and the–llibrary option to add object libraries to the linker's list of search libraries. The –L option must precede the associated library on the command line.

The link editor produces a dynamically linked executable named a.out by default. You can use the –o filename option to specify a different executable name. You can use the –c option to compile a source file and produce an object (.o) file but suppress linking.

To compile a source file named test.c and produce an executable file named a.out:

% cc test.c

To compile source files test1.c and test2.c and link them into an executable file called test:

% cc -o test test1.c test2.c

To compile the two source files separately and then link them into an executable:

% cc -c test1.c
% cc -c test2.c
% cc test1.o test2.o

C Documentation

For complete information about using the C compiler, and the cc command and its options, see the Oracle Solaris Studio 12.4: C User’s Guide and the cc(1) man page. For information about the new and changed features, see What’s New in Oracle Solaris Studio 12.4 . For information about problems and workarounds, and limitations and incompatibilities of the compiler, see Oracle Solaris Studio 12.4: Release Notes .