How to correctly add an OpenCV build to a QT application
-
I am compiling a Qt Quick QML project with opencv 4.0 used in it on Unbuntu 18.
I build the opencv 4 from source.
I also have an OpenCv 3.2 installed from ubuntu's repository.
To ensure it is actually using Opencv 4.0 I created an opencv.pri file as below:
INCLUDEPATH += -I/home/mike/opencv-4.0.1/ LIBS += -L/home/mike/opencv-4.0.1/build -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_videoio -lopencv_video
But if I remove "-L/home/mike/opencv-4.0.1/build" from above the code still compiles.
Does that mean it is using OpenCv 4 headers/includes and libraries from Opencv 3.2.
How else QT looks for libraries directory?
Thank you
-
hi @mikeitexpert,
How else QT looks for libraries directory?
Qt (and not QT, that is QuickTime) doesn't look for directories. It's the Linker doing that, and linking on Linux is complicated.*) You can google that up, there are multiple fallbacks taken in account when doing that.
Does that mean it is using OpenCv 4 headers/includes and libraries from Opencv 3.2.
Most likely, yes.
Regards
*) Well, on Windows it's not better, hence called the DLL hell. Good libraries are therefore versioned (like Qt)