-c

Purpose

Instructs the compiler to compile or assemble the source files only but do not link. With this option, the output is a .o file for each source file.

Syntax

Read syntax diagramSkip visual syntax diagram  -c

Defaults

By default, the compiler invokes the linker to link object files into a final executable.

Usage

When this option is in effect, the compiler creates an output object file, file_name.o, for each valid source file, such as file_name.c, file_name.i, file_name.C, file_name.cpp, or file_name.s. You can use the -o option to provide an explicit name for the object file.

The -c option is overridden if the -E or -fsyntax-only option is specified.

Predefined macros

None.

Examples

To compile myprogram.c to produce an object file myprogram.o, but no executable file, enter the command:

ibm-clang myprogram.c -c

To compile myprogram.c to produce the object file new.o and no executable file, enter the command:

ibm-clang myprogram.c -c -o new.o

Related information