use OpenVC in QT Creator V 11.0.3
Unsolved
Qt Creator and other tools
-
I created a new Project, where i wanted to use Openvc to play a video. I used qmake and QT version 5.15.15. Here is the generated .pro file
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++17 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../opencv/build/x64/vc16/lib/ -lopencv_world480 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../opencv/build/x64/vc16/lib/ -lopencv_world480d INCLUDEPATH += $$PWD/../../../../opencv/build/include DEPENDPATH += $$PWD/../../../../opencv/build/include
I tried to open a video with a simple example
#include "mainwindow.h" #include <QApplication> #include "opencv2/opencv.hpp" #include "opencv2/videoio.hpp" using namespace cv; int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); VideoCapture cap(0); return a.exec(); }
When i try to run this example i get a error message
undefined reference to `cv::VideoCapture::VideoCapture(int, int)` undefined reference to `cv::VideoCapture::~VideoCapture()` undefined reference to `cv::VideoCapture::~VideoCapture()`
Does someone has a idea how i can fix this error?
-
@PaulE
And what compiler/kit are you using? MSVC? Or MinGW...? Because-L$$PWD/../../../../opencv/build/x64/vc16/lib/ -lopencv_world480
looks like MSVC library in MinGW link...?
https://forum.qt.io/topic/152113/opencv-linking-undefined-references