Thursday, 3 December 2020

How to configure a Makefile with Opencv?

 First compile the opencv using the previous post


Second, modify the Makefile as following:-

all:demo

CFLAGS = `pkg-config --cflags opencv4`
LIBS = `pkg-config --libs opencv4`


SRC:=main.cpp  file2.cpp  file3.cpp  file4.cpp
demo:$(SRC)
    g++ $(CFLAGS) -std=c++11 -Wall -O2  $^  -c -Iffmpeg/include/  -I rtspperf/inc
    g++ $(LIBS) -g *.o -o main -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -ldl -lz -lm  -llzma
    @rm *.o -f

clean:
    rm -f demo


No comments:

Post a Comment