Skip to main content 
 Contents  Index  Dark Mode  Prev  Up Next   \(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle     \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle        \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle      \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\) 
Section   28.11   Compile the Library to an Object File 
 
In the code window below, inside the workspace folder (which is inside 
engs20), you can find three files:
complexlib.c (our complex number library)
 
complexlib.h (header file)
 
testComplex.c (test file, which includes main)
 
 
Activity   28.6 . 
 
Compile the library to an object file:
gcc -c -o complexlib.o complexlib.c
 
The -c flag instructs gcc to compile only, without linking and making an executable program.
 
The -o flag allows to specify the name of the output file "complexlib.o".
 
 
Note that 
complexlib.o is not an executable program (it has no 
main() for starters). It is simply the translation of our library into machine language.
If the server window does not load, please click here