There is no such concept as "difference". If you don't see it, try to tell us the difference between apple and Apple. Better avoid "difference" questions, just ask questions on each of the concept you feel to confuse.
Also, there is no such concept as "source program". There is such thing as "source code". As to "compilation unit", this concept is
orthogonal to the dichotomy between source and compiled code. Compilation unit is a unit based on the idea of
separate compilation. It does not matter what do you consider, source code for the unit or the unit as a result of compilation, you can consider either one, or both aspects of the unit. I hope it's clear.
Here is the idea. In some class of languages, you can have some source code in one file or set of files which can be
compiler without using other files of your project. In C++, this can be a .cpp file and all files included in it using
#include
directive, directly or indirectly. The result of compilation makes an
object file. Now, the point is, how to put it all together? The technique is based on the possibility to have some
unresolved symbols in the compilation. For example, some function can be written in the form of
declaration, without the
definition. Typically, such declaration is put in a header file which can be included in more than one unit. Still, such unit can be successfully compiled, assuming that the definition could be found in some other unit or a
library.
Another program called
linker takes all the compiled units and tries to link them together. On input of linker, some other object files can be added, for example, provided without source code by 3rd parties, as well as
object libraries (also called
static libraries). If all the external names are resolved altogether, the linkage produces
executable files (which include DLLs or
shared objects (*NIX name)), otherwise linker error is issued.
Please see:
http://en.wikipedia.org/wiki/Compiler[
^],
http://en.wikipedia.org/wiki/Linker_%28computing%29[
^],
http://en.wikipedia.org/wiki/Object_file[
^],
http://en.wikipedia.org/wiki/Library_%28computing%29[
^].
In the articles referenced by first two links, you can see the diagrams showing the build process and the role of a compiler and a linked, what goes on input and is produced in output, illustrating my description.
—SA