Required Includes and Libraries for OpenCV in Qt

Posted on Posted in OpenCV Tutorials, Qt Tutorials, Tutorials

Use the following lines in a .pri file that is added to your project by using “include(C:/opencv/opencv.pri)”

This allows easy including of headers and library references in a Qt project.

(Note that in case you are using another version of OpenCV, your library names might be different.)

Here it is:

INCLUDEPATH += C:/opencv/include

CONFIG(debug, debug|release) {
#LIBS += -LC:/opencv/staticlib
LIBS += -LC:/opencv/lib
} else {
#LIBS += -LC:/opencv/staticlib
LIBS += -LC:/opencv/lib


(Updated on 2015-12-15)

Or you can just simply download my .PRI file below and include it in your project (if you have OpenCV installed in C drive’s root)


Leave a Reply

Your email address will not be published. Required fields are marked *