Creating a Makefile

My own experiences with makefiles are pretty limited, so this is a simple but effective solution:

Root users will be able to use the following. [Download]

INCPATH = -I/home/intel/opencv/include/opencv
LIBPATH = -L/home/intel/opencv/lib/
OPTIONS = -lcv -lcvaux -lcxcore -lhighgui -lstdc++
%:%.c
[tab] g++ $(INCPATH) $(LIBPATH) $(OPTIONS) $^ -o $@

Non-root users will be able to use this one. (Remember to substitute your folder path instead of /tmp/intelocv/). [Download]

INCPATH = -I/home/opencv/include/opencv
LIBPATH = -L/home/opencv/lib/
OPTIONS = -lcv -lcvaux -lcxcore -lhighgui -lstdc++ -Wl,--rpath -Wl,/home/opencv/lib/
%:%.c
[tab] g++ $(INCPATH) $(LIBPATH) $(OPTIONS) $^ -o $@

(The difference is in what happened with ldconfig on the previous page. Whereas root users will now have access to the libraries by default, non-root users will have to include a few extra commands in the makefile to get the same effect.)