Learn how to use object files (.o), archives (.a) and shared objects (.so) when compiling c/c++:
http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html
http://crasseux.com/books/ctutorial/Building-a-library.html
http://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html