Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have found another old Makefile, which I used with an old OpenCV-version. However, I don't know if OpenCV's pkg-files have been fixed again.

CC=g++
#CFLAGS+=-g
CFLAGS+=`pkg-config --cflags opencv`
LDFLAGS+=`pkg-config --libs opencv`

PROG=opencvtest
OBJS=$(PROG).o

.PHONY: all clean
$(PROG): $(OBJS)
    $(CC) -o $(PROG) $(OBJS) $(LDFLAGS)

%.o: %.cpp
    $(CC) -c $(CFLAGS) $<

all: $(PROG)

clean:
    rm -f $(OBJS) $(PROG)

Here the correct flags (i.e. -I -L ) are handled by pkgconfig, i.e. also that you need to set the PKG_CONFIG_PATH to the folder which contains the opencv.pc-file.