Jun 18, 2021
How to compile in GCC
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages (libstdc++,…). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user’s freedom.
Creating our program in C
#include <stdio.h>int main(void)
{char text[100] = "Hello World";printf("%s", text);return (0);}
First we will compile our program
gcc hello_world.c -o hello_world.o
Then we will have to give execution permissions to our final file:
chmod u+x hello_world.o
Finally we execute our output file:
./hello_world.o
Assuming that main.c exists and contains code, what will happen is the compilation process that will later create an executable named a.out.