gcc -c option flag

 

gcc -c option flag

gcc -c compiles source files without linking.

 

Syntax

$ gcc -c [options] [source files]

 

Example

Write source file myfile.c:

// myfile.c
#include <stdio.h>
 
void main()
{
    printf("Program run\n");
}

 

Compile myfile.c:

$ gcc -c myfile.c

This compilation generated myfile.o object file.

 

See also