| Previous Slide | Separate Compilation | Next Slide |
Let's review what we need to do to compile this program
separately (i.e., to intermediate object files) and
then link it into an executable named main.
To just compile source code, use the
% g++ -c main.cpp % g++ -c Point.cpp % g++ -c Rectangle.cpp This will generate the object files:
Then, to link the object files ( % g++ -o main main.o Point.o Rectangle.o |