put header into a separate file myUtil.h in the directory include put functions into a separate file (myUtil.cc) add c++ headers and your own header compile with g++ -c myUtil.cc -o myUtil.o -Iinclude compile main without the source functions included, and add the Object code g++ myMain.cc myUtil.o create a library with ar g++ -c normalenVektorUtil.cc -o normalenVektorUtil.o -Iinclude ar rcs libmyVektorUtil.a normalenVektorUtil.o link the library g++ normalenVektorMain.cc -Iinclude -Llib -lmyVektorUtil