1.4. Explanation of compilation¶
For Basic Compilation, we convert the source code hello_world.c
into something that we can run and execute (a.out
). To do that hello_world.c
is compiled into an executable file called a.out
.
hello_world.c
used in this example is simple, and pretty much platform independent. It would work on many OSes/platforms such as Linux / Windows / Mac, etc. And it would also work with various compilers like gcc
, Microsoft Visual C Compiler, the CLang compiler, etc. Different types of processors such as ARM, 32bit x86, 64bit x86-64, etc. But once it is compiled, it is compiled by a specific compiler/toolchain to be tightly bound to specific operating system and hardware architecture.
gcc hello_world.c
In this example, we compiled the code with gcc
. gcc
is Open Source compiler available on a variety of platforms. The second parameter is hello_world.c
. With this we are giving a direction to gcc
to compile the corresponding file.