I am trying to make a qt program work with opencv without success. Qt, alone works. And opencv alone works (in Eclipse).
Here is my very simple C code from mainwindow.cpp file:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <opencv2/opencv.hpp>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
cv::Mat image = cv::imread("my_image.png");
cv::imshow("Display", image);
}
MainWindow::~MainWindow()
{
delete ui;
}
And now my qmake file where there is maybe a problem, because of the linking : QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test
TEMPLATE = app
INCLUDEPATH += /usr/local/include/opencv
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgcodecs
And the worst (or the best) for the end, my awful error :
warning: libopencv_core.so.3.3, needed by /usr/local/lib/libopencv_imgcodecs.so, may conflict with libopencv_core.so.2.4
error: error adding symbols: DSO missing from command line /usr/local/lib/libopencv_core.so.3.3:
error: collect2: error: ld returned 1 exit status
I really hope that someone will read my message and could offer a solution. Maybe the best should be to uninstall and reinstall opencv or qt, I don't know.
Thanks,
Demangling the missing symbol:
$ c++filt -n _ZN2cv6String10deallocateEv
cv::String::deallocate()
You seem to be mixing objects or libraries using opencv2 and opencv3. I would check your system and make sure only one is installed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.