Instructs the compiler to pass source files to the compiler component only. The compiled source files are not sent to the linkage editor. 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.


Read syntax diagramSkip visual syntax diagram>>- -c---------------------------------------------------------><


The -c option is overridden if either the -E, -P, or -qsyntaxonly options are specified.

The -c option can be used in combination with the -o option to provide an explicit name of the object file that is created by the compiler.


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

xlc++ myprogram.C -c

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

xlc++ myprogram.C -c -o new.o

Related information