Compiling and Linking


Click here to change the theme.

I need to put more into this article.

Making

The "make" utility helps compiling, linking and making executables. In it's simplest form, it "makes" files conditionally depending on whether they are out of date or non-existing relative to other files that are dependents. In other words, if an executable is older than the source files that create them, then the executable is made by compiling the source files. For Visual C++ (VC) there is a modified make called nmake.

When using VC, we usually do not use nmake or make, but the process that VC does do when a project is built is based on what make would do to build a project. I will explain later.

Compiling

A compiler such as the Visual C++ (VC) compiler converts source language to machine code. The machine code cannot be executed directly; it must be linked with other code. The output of most compilers is object files. Every input file (.c or .cpp) for the compiler is compiled to a object file. Note that include files (.h) are processed due to #include statements; they are not what is meant by an input file.

Linking

The linker combines object files into an executable file (exe or dll). The use of object files and the linker allows us to have multiple source files. It is even possible to combine object files from more than one compiler; that is, from source files in more than one language.