Compilation and linking

The translation process from C++ code to executable is called building, carried out in two stages:

  1. compilation: production of an intermediate object file (.o) with unresolved external symbols
  2. linking: resolve external symbols by reading code from standard and user-defined libraries
int getReturnValue(void);
int main() {
int ret = 0;
ret = getReturnValue();
return ret;
}
% latex2html id marker 4060
\fbox{\begin{minipage}{4cm}
{ {\it Compilation} $...
...e
for undefined symbols ({\tt {\color{red} getReturnValue}})}
\end{minipage}}
main: 0010 1101 ... getReturnValue
% latex2html id marker 4066
\fbox{\begin{minipage}{3cm}
{ {\it Linking} $\rig...
...t .o}) for unresolved symbols definitions, produces executable}
\end{minipage}}



Leo Liberti 2008-01-12