Go to main content
Oracle® Developer Studio 12.6: C User's Guide

Exit Print View

Updated: July 2017

C Compiler Options Reference

This chapter describes the C compiler options in alphabetical order. See Compiler Options Grouped by Functionality for options grouped by functionality. For example, Table 22 lists all the optimization and performance options.

The C compiler recognizes by default some of the constructs of the 2011 ISO/IEC C standard. The supported features are detailed in Features of C 11. Use the -std command if you want to limit the compiler to a previous version of ISO/IEC C standard.

B.1 Option Syntax

The syntax of the cc command is:

% cc [options] filenames [libraries]...


  • options represents one or more of the options described in Table 35.

  • filenames represents one or more files used in building the executable program

    The C compiler accepts a list of C source files and object files contained in the list of files specified by filenames. The resulting executable code is placed in a.out, unless the –o option is used. In this case, the code is placed in the file named by the –o option.

    Use the C compiler to compile and link any combination of the following:

    • C source files, with a .c suffix

    • Inline template files, with a .il suffix (only when specified with .c files)

    • C preprocessed source files, with a .i suffix

    • Object-code files, with .o suffixes

    • Assembler source files, with .s suffixes

      After linking, the C compiler places the linked files, now in executable code, into a file named a.out, or into the file specified by the –o option. When the compiler produces object code for each .i or .c input file, it always creates an object (.o) file in the current working directory.

    libraries represents any of a number of standard or user-provided libraries containing functions, macros, and definitions of constants.

Use the option –YP, dir to change the default directories used for finding libraries. dir is a colon-separated path list. The default library search order can be seen by using the -### or -xdryrun option and examining the -Y option of the ld invocation.

cc uses getopt to parse command-line options. Options are treated as a single letter or a single letter followed by an argument. See thegetopt(3c) man page.