Linux and Unix cc command

Quick links

About cc
Syntax
Examples
Related commands
Linux and Unix main page

About cc

C compiler.

Syntax

cc [ options ]

-cCompiles only; does not attempt to link source files.
-D name[=value]Is passed to C compiler to assign the indicated value to the symbol name when the C preprocessor is run.
-f floatSpecifies the floating point options that the compiler and linker use. The following should be supported:

-f -  - no floating point required
-f - emulated floating point
-fp hardware floating point (using 80x87 coprocessor)

-IdirSearch dir for included files whose names do not begin with a slash (/) prior to searching the usual directories. The directories for multiple -I options are searched in the order specified. The preprocessor first searches for #include files in the directory containing sourcefile, and then in directories named with -I options (if any), then /usr/ucbinclude, and finally, in /usr/include.
-LdirAdd dir to the list of directories searched for libraries by /usr/ccs/bin/ucbcc. This option is passed to /usr/ccs/bin/ld and /usr/lib. Directories specified with this option are searched before /usr/ucblib and /usr/lib.
-l libraryIf linking, adds the indicated library to the list of libraries to be linked.
-MIf linking, creates a map file with the same base name as the output executable, but with the suffix .map. This map file contains a list of symbols with their addresses.
-m modelSpecifies the memory model that the compiler and linker use. The models may include:
-mssmall model
-mmmedium model
-mllarge model
-mfflat model (32-bit)
-mccompact model
-mhhuge model
-o outputIf linking, places the executable output in the file output.
-SProduces assembler listing with source code.
-UnameIs passed to the C compiler, to undefined the symbol name.
-Y P, dirChange the default directory used for finding libraries.

Examples

cc myfile.c

Compile the file myfile.c.

Related commands

ld