gcc Command - Compile and Link C language Source Code

The gcc command is a command for compiling and linking C language source code.

To compile and link and generate an executable file, use the "-o" option with the gcc command.

gcc -o OutputFileName InputFileName

Specify the output file name with the "-o" option.

gcc -o OutputFileName InputFileName

This command will compile and link all at once. Since there is only one input file, I don't feel like linking. I haven't explained the meaning of the word link yet. Let's try as far as we can.

Let's create an executable file called "test" from a C language source file called "test.c".

// test.c

#include <stdio.h>

int main (void) {
  printf ("Hello World!\n");
}

Generate an executable file with the gcc command.

gcc -o test test.c

Procedure for building a C language development environment using gcc

Please refer to the following article for the procedure for building a C language development environment using gcc.

Develop in C language

To actually develop in C language using gcc, please refer to the following site.

Associated Information