Build the Program

To compile your assignment, use the following commands:

  1. g++ -Wall -c Dog.cpp
  2. g++ -Wall -c lab3.cpp
  3. g++ -Wall Dog.o lab3.o -o lab3

The build steps for this program are a bit different than previous examples. Here is a line-by-line explanation:

  1. On the first line, the -c option causes Dog.cpp to be compiled but not linked. The output of this step is a file named Dog.o.
  2. Similarly, the second line compiles, but does not link, the program lab3.cpp and produces the file lab3.o.
  3. The third line links the files Dog.o and lab3.o and adds additional code needed to produce the executable program lab3. Linking is the step in which the calls to class methods in lab3.cpp are bound to actual functions in the Dog class.