Hello to everyone,
I know this problem is already discussed, but I can't find a way to solve it.
I built the OpenCV (3.4.15) libraries in dynamic and static versions in Linux Mint 21.1, without problems, but I have some difficulties using them in my QT project (using qtcreator).
The dynamic version work very well, but the static ones give me some errors I can't solve (I googled to find a solution but without result)
In my pro file I called (dynamic version):
LIBS +=-L/usr/local/lib/
LIBS += -lopencv_calib3d
LIBS += -lopencv_core
LIBS += -lopencv_features2d
LIBS += -lopencv_flann
LIBS += -lopencv_highgui
LIBS += -lopencv_imgcodecs
LIBS += -lopencv_imgproc
LIBS += -lopencv_ml
LIBS += -lopencv_objdetect
LIBS += -lopencv_photo
LIBS += -lopencv_shape
LIBS += -lopencv_stitching
LIBS += -lopencv_superres
LIBS += -lopencv_video
LIBS += -lopencv_videoio
LIBS += -lopencv_videost
LIBS +=-L/usr/local/lib/
LIBS += -lopencv_calib3d
LIBS += -lopencv_core
LIBS += -lopencv_features2d
LIBS += -lopencv_flann
LIBS += -lopencv_highgui
LIBS += -lopencv_imgcodecs
LIBS += -lopencv_imgproc
LIBS += -lopencv_ml
LIBS += -lopencv_objdetect
LIBS += -lopencv_photo
LIBS += -lopencv_shape
LIBS += -lopencv_stitching
LIBS += -lopencv_superres
LIBS += -lopencv_video
LIBS += -lopencv_videoio
LIBS += -lopencv_videost
To copy to clipboard, switch view to plain text mode
and it's ok. but when I tried to use the static version replacing the previous lines with this code:
LIBS +=/usr/local/lib/libopencv_calib3d.a -lopencv_calib3d
LIBS +=/usr/local/lib/libopencv_core.a -lopencv_core
LIBS +=/usr/local/lib/libopencv_features2d.a -lopencv_features2d
LIBS +=/usr/local/lib/libopencv_flann.a -lopencv_flann
LIBS +=/usr/local/lib/libopencv_highgui.a -lopencv_highgui
LIBS +=/usr/local/lib/libopencv_imgcodecs.a -lopencv_imgcodecs
LIBS +=/usr/local/lib/libopencv_imgproc.a -lopencv_imgproc
LIBS +=/usr/local/lib/libopencv_ml.a -lopencv_ml
LIBS +=/usr/local/lib/libopencv_objdetect.a -lopencv_objdetect
LIBS +=/usr/local/lib/libopencv_photo.a -lopencv_photo
LIBS +=/usr/local/lib/libopencv_shape.a -lopencv_shape
LIBS +=/usr/local/lib/libopencv_stitching.a -lopencv_stitching
LIBS +=/usr/local/lib/libopencv_superres.a -lopencv_superres
LIBS +=/usr/local/lib/libopencv_video.a -lopencv_video
LIBS +=/usr/local/lib/libopencv_videoio.a -lopencv_videoio
LIBS +=/usr/local/lib/libopencv_videostab.a -lopencv_videostab
LIBS +=/usr/local/lib/libopencv_calib3d.a -lopencv_calib3d
LIBS +=/usr/local/lib/libopencv_core.a -lopencv_core
LIBS +=/usr/local/lib/libopencv_features2d.a -lopencv_features2d
LIBS +=/usr/local/lib/libopencv_flann.a -lopencv_flann
LIBS +=/usr/local/lib/libopencv_highgui.a -lopencv_highgui
LIBS +=/usr/local/lib/libopencv_imgcodecs.a -lopencv_imgcodecs
LIBS +=/usr/local/lib/libopencv_imgproc.a -lopencv_imgproc
LIBS +=/usr/local/lib/libopencv_ml.a -lopencv_ml
LIBS +=/usr/local/lib/libopencv_objdetect.a -lopencv_objdetect
LIBS +=/usr/local/lib/libopencv_photo.a -lopencv_photo
LIBS +=/usr/local/lib/libopencv_shape.a -lopencv_shape
LIBS +=/usr/local/lib/libopencv_stitching.a -lopencv_stitching
LIBS +=/usr/local/lib/libopencv_superres.a -lopencv_superres
LIBS +=/usr/local/lib/libopencv_video.a -lopencv_video
LIBS +=/usr/local/lib/libopencv_videoio.a -lopencv_videoio
LIBS +=/usr/local/lib/libopencv_videostab.a -lopencv_videostab
To copy to clipboard, switch view to plain text mode
the result is:
:-1: error: /usr/local/lib/libopencv_objdetect.a(qrcode.cpp.o): undefined reference to symbol '_ZN2cv11contourAreaERKNS_11_InputArrayEb'
:-1: error: /usr/local/lib//libopencv_imgproc.so: error adding symbols: DSO missing from command line
:-1: error: collect2: error: ld returned 1 exit status
:-1: error: [Makefile:806: TestApp] Error 1
I can't understand the reason for the undefined symbols (includes and loading order of libraries should be ok), so I am asking for help.
Note: I'm not sure about the need for -l+library parameter, but without it I received tons of errors.
Thank a lot!
Bookmarks