Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Compile problem for Raspberry Pi 3 with opencv
Hello guys, I'm doing a project on Rpi 3, and I use QTcreator to make a GUI application. I also try to use opencv for my code. But the problem: when compiling, error
*:-1: error: mainwindow.o: undefined reference to symbol '_ZN2cv6imreadERKNS_6StringEi'
/usr/local/lib/libopencv_imgcodecs.so.3.0:-1: error: error adding symbols: DSO missing from command line*
I dont know how to fix it. Anyone has suggestion? Thank you.
This is my imported libraries in .pro file
INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
LIBS += -lopencv_ml
LIBS += -lopencv_video
LIBS += -lopencv_features2d
LIBS += -lopencv_calib3d
LIBS += -lopencv_objdetect
LIBS += -lopencv_contrib
LIBS += -lopencv_legacy
LIBS += -lopencv_flann
LIBS += -lopencv_nonfree
Hi and welcome to devnet,
Are you developing on the RPi3 directly ? Or are you cross-compiling ?
I installed Qt and Qtcreator by "apt-get install qt5-default/qtcreator". Qtcreator run successfully without opencv.
You didn't answer my question: are you developing directly on the RPi3 ?
@SGaist Yes =D sr I'm a little bit confused
Good then next question, did you build OpenCV yourself ? Or did you install the one from the distribution you have on your Pi ?
@SGaist I built OpenCV due to this guide: http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
You are missing
-lopencv_imgcodecsin your .pro file.
@SGaist It works, thank you so much. Aw I didnt focus on this mistake.
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)