1
votes

I have downloaded OpenCV 2.4.11 for windows from here and have set it up for Visual Studio 2013(x86) like this way:

RB=right button

  • RB on project -> Configuration Properties -> Debugging -> Environment

PATH=%PATH%;D:\opencv_2411\opencv\build\x86\vc12\bin

  • RB on project -> Configuration Properties -> C/C++ -> General -> Additional Include Directories

D:\opencv_2411\opencv\build\include

  • RB on project -> Configuration Properties -> Linker -> General -> Additional Library Directories

D:\opencv_2411\opencv\build\x86\vc12\lib

  • RB on project -> Configuration Properties -> Linker -> Input -> Additional Library Directories
opencv_calib3d2411d.lib
opencv_contrib2411d.lib
opencv_core2411d.lib
opencv_features2d2411d.lib
opencv_flann2411d.lib
opencv_gpu2411d.lib
opencv_highgui2411d.lib
opencv_imgproc2411d.lib
opencv_legacy2411d.lib
opencv_ml2411d.lib
opencv_nonfree2411d.lib
opencv_objdetect2411d.lib
opencv_ocl2411d.lib
opencv_photo2411d.lib
opencv_stitching2411d.lib
opencv_superres2411d.lib
opencv_ts2411d.lib
opencv_video2411d.lib
opencv_videostab2411d.lib
  • The includes:
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;

Everything was OK, but now I am trying to do the same thing in QT 5.5:

enter image description here

I made new "QT Witgets Application" with base class "QDialog" and these kits:

enter image description here

With the use of this .pro file:

    #-------------------------------------------------
#
# Project created by QtCreator 2015-10-07T10:54:31
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = asd
TEMPLATE = app


SOURCES += main.cpp\
        dialog.cpp

HEADERS  += dialog.h

FORMS    += dialog.ui

INCLUDEPATH += D:\opencv_2411\opencv\build\include
LIBS += D:\opencv_2411\opencv\build\x64\vc12\lib \
-lopencv_calib3d2411.lib \
-lopencv_core2411.lib \
-lopencv_features2d2411.lib \
-lopencv_flann2411.lib \
-lopencv_highgui2411.lib \
-lopencv_imgproc2411.lib \
-lopencv_ml2411.lib \
-lopencv_objdetect2411.lib \
-lopencv_photo2411.lib \
-lopencv_stitching2411.lib \
-lopencv_superres2411.lib \
-lopencv_ts2411.lib \
-lopencv_video2411.lib \
-lopencv_videostab2411.lib

I run qmake to apply changes in .pro file. In my source file I have:

#include "dialog.h"
#include <QApplication>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Dialog w;
    w.show();

    return a.exec();
}

When the Build is Run the following error occures:

:-1: error: LNK1104: cannot open file 'D:\opencv_2411\opencv\build\x64\vc12\lib.obj'

How can I fix this?

1
LIBS += -L<PATH> maybe?Miki

1 Answers

1
votes

Thanks to Miki the final addition to the .pro file is this:

INCLUDEPATH += D:\opencv_2411\opencv\build\include
LIBS += -LD:\opencv_2411\opencv\build\x64\vc12\lib \
-lopencv_calib3d2411 \
-lopencv_core2411 \
-lopencv_features2d2411 \
-lopencv_flann2411 \
-lopencv_highgui2411 \
-lopencv_imgproc2411 \
-lopencv_ml2411 \
-lopencv_objdetect2411 \
-lopencv_photo2411 \
-lopencv_stitching2411 \
-lopencv_superres2411 \
-lopencv_ts2411 \
-lopencv_video2411 \
-lopencv_videostab2411

But if you still have problems with imread and other functions see this topic.