我正在使用Ubuntu 16.04,Qt5和Opencv-master
我已经安装了Opencv和Opencv_contrib(两天前来自github),我正在尝试运行此示例模式:
#include "surf.h"
#include <QApplication>
#include <opencv/cv.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char *argv[])
{
cout << "Hola" << endl;
cv::Mat img_object = cv::imread("/home/juan/Descargas/1.jpg", CV_LOAD_IMAGE_COLOR);
//imshow("A buscar", img_object);
waitKey(0);
}
与此.pro
#-------------------------------------------------
#
# Project created by QtCreator 2018-10-27T21:20:58
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Surf
TEMPLATE = app
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs -lopencv_highgui
SOURCES += main.cpp\
surf.cpp
HEADERS += surf.h
FORMS += surf.ui
当我尝试运行它时,我发现了下一个错误:
:-1: warning: libopencv_core.so.3.0, needed by /usr/local/lib/libopencv_imgcodecs.so, may conflict with libopencv_core.so.2.4
:-1: error: main.o: undefined reference to symbol '_ZN2cv6String10deallocateEv'
/usr/local/lib/libopencv_core.so.3.0:-1: error: error adding symbols: DSO missing from command line
:-1: error: collect2: error: ld returned 1 exit status
有人有什么主意吗?