Skip to main content
Logo image

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.