Getting the Basics of Linking Right

Let's learn about how and when to link files in CMake.

The life cycle of a C++ program consists of five main stages: writing, compiling, linking, loading, and execution. After correctly compiling all the sources, we need to put them together into an executable.

Structure of an object file

Object files produced in a compilation can't be executed by a processor directly. But why? To answer this, let's take a look at how a compiler structures an object file in the popular ELF format (used by Unix-like systems and many others):

Get hands-on with 1200+ tech skills courses.