OpenCV 2.4.9 QT issue with imread

asked 2014-05-14 08:54:11 -0500

I get an error when compiling with the cv::imread function (very basic one) included the right files and the .pro is good:

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = OpenCVTest TEMPLATE = app

INCLUDEPATH += /home/carlos/OpenCV/opencv-2.4.9

LIBS += -L /home/carlos/OpenCV/opencv-2.4.9/build/lib/ -libopencv_core.so -llibopencv_highgui.so -llibopencv_imgproc.so -llibopencv_features2d.so -llibopencv_calib3d.so

SOURCES += main.cpp\ mainwindow.cpp

HEADERS += mainwindow.h

FORMS += mainwindow.ui

My main file is this:

include "mainwindow.h"

include "QApplication"

include "include/opencv/highgui.h"

include "modules/core/include/opencv2/core/core.hpp"

include "modules/highgui/include/opencv2/highgui/highgui.hpp"

using namespace std;

using namespace cv;

int main(int argc, char *argv[]){

QApplication a(argc, argv);
MainWindow w;
w.show();

Mat image = cv::imread("descarga.jpg",0);
namedWindow("My Image");
imshow("My Image", image);
waitKey(5000);

return a.exec();

}

The error is:

/home/carlos/Programing/OpenCVTest/main.cpp:16: error: undefined reference to `cv::imread(std::string const&, int)'

I think is well implemented, is something wrong with code or it's just that it has changed for OpenCV 2.4.9?

edit retag flag offensive close merge delete

Comments

wait, shouldn't you link -lopencv_.a instead of -lopencv_.so ?

berak gravatar imageberak ( 2014-05-14 09:00:33 -0500 )edit