Building your Program

You can build your program with the following commands:

     g++ -c lab5.cpp
     g++ -c Complex.cpp
     g++ lab5.o Complex.o -o lab5

There are two distinct steps in the program build:

  1. lab5.cpp and Complex.cpp are compiled to produce the object files lab5.o and Complex.o. Object files consist of machine-readable code, but are not executable from the command line.
  2. The objects files are linked to produce the executable lab5.

Understanding this explict form of the build process is necessary to be able to write makefiles. Complete the following makefile, and demonstrate to your TA that it works correctly.

     CPPFLAGS = -ansi -Wall

     lab5: WHAT GOES HERE...
          AND HERE?

     lab5.o: lab5.cpp Complex.h
          WHAT GOES HERE?

     Complex.o: WHAT GOES HERE...
          AND HERE?