Compiling is the act of taking a source code text file and running it through a compiler program to produce a program that can run on the computer.
Programmer writes the source code in plain text, often in an IDE (Integrated Development Environment)
The program is then compiled (converted) to a language that the computer can understand, and run as a program.
This is normally a two step process that consists of:
- Pulling in any specified header files and creating Assembly (or object) code native to the processor
- Using a linker program to pull in any other object or library files required, to finally output machine code (1's and 0's)
This resulting code is usually known as a binary or executable file.
The program can then be run (or executed) on the computer.
The gnu C compiler is invoked by opening a terminal and entering gcc on the command line.
Typically gcc takes a number of arguments, such as the file to be compiled and the output name:
gcc hello_world.cpp -o hello_world
*in windows, the output file type would need an .exe extension added to tell windows that its an executable program:
gcc hello_world.cpp -o hello_world.exe