Why after linking the OpenCV libraries, Mat objects are still 'undefined'?
-
That's not a linking problem you have there.
Where is opencv2/core.hpp located exactly in your system ?
-
Did you notice the "opencv4" folder that is missing from your INCLUDEPATH statement ?
Either add it there or to your include statements.
-
Please provide the information directly.
What exactly did you try ?
What is the error your get ? -
@SGaist said in Why after linking the OpenCV libraries, Mat objects are still 'undefined'?:
Did you notice the "opencv4" folder that is missing from your INCLUDEPATH statement ?
Either add it there or to your include statements.
I wrote "either" which means one or the other, not both.
-
So I changed it in the main.cpp file because otherwise I got those errors . Now in the .pro file is /usr/local/include.
I still get the same errors
The last error I don't understand because I wrote opencv2/core/core.hpp not opencv2/core.hpp and I cleaned the project again before
-
So I changed it in the main.cpp file because otherwise I got those errors . Now in the .pro file is /usr/local/include.
I still get the same errors
The last error I don't understand because I wrote opencv2/core/core.hpp not opencv2/core.hpp and I cleaned the project again before
-
@georgiav Change INCLUDEPATH in your pro file so, that it points to /usr/local/include/opencv4 and change your includes like
#include "opencv2/...
-
Here is a minimal example adjusted to the paths you shown to us:
.pro file:
TEMPLATE = app TARGET = test_opencv INCLUDEPATH += . INCLUDEPATH += /usr/local/include/opencv4 LIBS += -L/usr/local/lib/ -lopencv_core SOURCES += main.cpp
main.cpp:
#include <opencv2/core.hpp> int main(int argc, char **argv) { cv::Mat mat; return 0; }
-
Here is a minimal example adjusted to the paths you shown to us:
.pro file:
TEMPLATE = app TARGET = test_opencv INCLUDEPATH += . INCLUDEPATH += /usr/local/include/opencv4 LIBS += -L/usr/local/lib/ -lopencv_core SOURCES += main.cpp
main.cpp:
#include <opencv2/core.hpp> int main(int argc, char **argv) { cv::Mat mat; return 0; }
-
@georgiav said in Why after linking the OpenCV libraries, Mat objects are still 'undefined'?:
this seems to work fine!
so please don't forget to mark your post as solved!
-