I am learning OpenCV using Learning OpenCV book.
One problem I am facing while compiling the code is that I have to write a long command to compile and get the executabl
GNU Make is pretty smart and the Makefile you need for this doesn't need to be as verbose as in the other answers given so far. Here is a simple Makefile which you can use to compile the OpenCV examples:
CPPFLAGS = $(shell pkg-config --cflags opencv)
LDLIBS = $(shell pkg-config --libs opencv)
That's it. The Makefile can be this short thanks to Make's implicit rules.
Then run make
as usual:
make facedetect
This assumes there is a facedetect.c
or facedetect.cpp
in the same directory.
I recommend the following (free!) book if you want to learn Make: http://oreilly.com/catalog/make3/book/index.csp