OpenCV linking undefined References
-
wrote on 15 Nov 2023, 14:43 last edited by IJoulz
Hi all,
i have read many already existing topics, but i haven't found one that fixes my issue.
I want to use OpenCV in my project but i can not resolve some undefined references.
I am using the default 'Desktop Qt 6.6.0 MinGW 64-bit' kit..pro:
... win32:CONFIG(release, debug|release): LIBS += -L$$(OpenCV_DIR)/x64/vc16/lib/ -lopencv_world480 else:win32:CONFIG(debug, debug|release): LIBS += -L$$(OpenCV_DIR)/x64/vc16/lib/ -lopencv_world480d INCLUDEPATH += $$(OpenCV_DIR)/include DEPENDPATH += $$(OpenCV_DIR)/include ...
Usage of OpenCV in a class:
... #include <opencv2/opencv.hpp> class OpenCVHelper : public QObject { Q_OBJECT public: OpenCVHelper(); ~OpenCVHelper(); cv::Mat m_rawCameraImage; cv::VideoCapture m_camera; };
Errors:
- undefined reference to `cv::Mat::Mat()'
- undefined reference to `cv::VideoCapture::VideoCapture()'
- ... and some other Stuff like their respective destructors.
The OpenCV_DIR Enviroment variable holds 'C:\OpenCV\opencv\build'.
Can someone point me in the correct direction, how i can include this lib correctly?
(The Includepath works btw)Thank you in advance.
-
Hi all,
i have read many already existing topics, but i haven't found one that fixes my issue.
I want to use OpenCV in my project but i can not resolve some undefined references.
I am using the default 'Desktop Qt 6.6.0 MinGW 64-bit' kit..pro:
... win32:CONFIG(release, debug|release): LIBS += -L$$(OpenCV_DIR)/x64/vc16/lib/ -lopencv_world480 else:win32:CONFIG(debug, debug|release): LIBS += -L$$(OpenCV_DIR)/x64/vc16/lib/ -lopencv_world480d INCLUDEPATH += $$(OpenCV_DIR)/include DEPENDPATH += $$(OpenCV_DIR)/include ...
Usage of OpenCV in a class:
... #include <opencv2/opencv.hpp> class OpenCVHelper : public QObject { Q_OBJECT public: OpenCVHelper(); ~OpenCVHelper(); cv::Mat m_rawCameraImage; cv::VideoCapture m_camera; };
Errors:
- undefined reference to `cv::Mat::Mat()'
- undefined reference to `cv::VideoCapture::VideoCapture()'
- ... and some other Stuff like their respective destructors.
The OpenCV_DIR Enviroment variable holds 'C:\OpenCV\opencv\build'.
Can someone point me in the correct direction, how i can include this lib correctly?
(The Includepath works btw)Thank you in advance.
@IJoulz said in OpenCV linking undefined References:
I am using the default 'Desktop Qt 6.6.0 MinGW 64-bit' kit.
Why do you try to link against msvc libs then?
LIBS += -L$$(OpenCV_DIR)/x64/vc16/lib/ -lopencv_world480
You can not mix MSVC and MinGW c++ libraries.
-
@IJoulz said in OpenCV linking undefined References:
I am using the default 'Desktop Qt 6.6.0 MinGW 64-bit' kit.
Why do you try to link against msvc libs then?
LIBS += -L$$(OpenCV_DIR)/x64/vc16/lib/ -lopencv_world480
You can not mix MSVC and MinGW c++ libraries.
wrote on 15 Nov 2023, 16:01 last edited by@Christian-Ehrlicher Well, that explains it *facepalm*.
I didnt catch that. -
-
1/3