allAboutSeparateCompilation.txt As we can see, neither drawTexasFlag.cpp nor drawings.cpp is "complete" on its own: > cd lab04 > ls Makefile drawNightFlags.sh drawTexasFlag.sh drawings.h drawNightFlags.cpp drawTexasFlag.cpp drawings.cpp > As you can see, we only have .cpp and .h and files, and a Makefile in this directory at the moment. > CC drawTexasFlag.cpp Undefined first referenced symbol in file void writeGnuplotFile(const char*const,const char*const,const char*const,double,double) drawTexasFlag.o void drawTexasFlag(std::ostream &,double,double,double) drawTexasFlag.o ld: fatal: Symbol referencing errors. No output written to a.out > drawTexasFlag.cpp "needs" a couple of functions it doesn't have > CC drawings.cpp Undefined first referenced symbol in file main /opt/SUNWspro/prod/lib/crt1.o ld: fatal: Symbol referencing errors. No output written to a.out > drawings.cpp needs a main to be complete. We need to bring the two of these together. Each has what the other needs. A kind of geek love story. So now we compile each, "without linking". The -c flag on the compiler means "compile, but don't link". In each case, the output will be a _____________________ not an exectuable file. > CC -c drawTexasFlag.cpp > CC -c drawings.cpp > The answer to fill in the blank is a ".o" file (pronounced "dot oh".) For example, the command > CC -c drawTexasFlag.cpp produces the file drawTexasFlag.o and the command > CC -c drawings.cpp produces the command drawings.o To link the two together into an executable file, you use the command: CC drawings.o drawTexasFlag.o -o drawTexasFlag The order of the .o files is not important, but "drawTexasFlag" has to come immediately after -o. The name of the executable comes from the file that contains the main. So in this case, since the main function was in drawTexasFlag.cpp, we use "-o drawTexasFlag" to get an exectuable named "drawTexasFlag".