What happens when you type gcc main.c

joel silva
Nov 6, 2020

--

When you create a program in C the computer needs to understand the instructions that you are giving it through the program. To do that it needs to run a compiler to translate the program info into an executable file that runs the instructions.

First of all you have to be sure that your gcc compiler is already installed on your computer. To do that you can run apt-get install it on your Ubuntu server following the next steps:

  1. Update the packages list:

$ sudo apt update

2. Install the build-essential package:

$ sudo apt install build-essential

3. Install the manual pages about using GNU/Linux for development:

$ sudo apt-get install manpages-dev

4. Use the gcc --version command to validate that the GCC compiler is successfully installed:

$ gcc — -version

When you have the GCC compiler you can start by creating a .c file with your program. It should look like this:

#include <stdio.h>
int main()
{
printf (“The main function is the first function in your program that is executed when it begins executing, but it’s not the first function executed.\n”);
return 0;
}

--

--

joel silva
joel silva

No responses yet