Linking external library in QT Creator

1.2k views Asked by At

I need your help. I'm trying to link an external library with QT Creator I get three LNK2019 errors

mainwindow.obj:-1: error: LNK2019: unresolved external symbol ""void __cdecl cv::projectPoints(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,class cv::_OutputArray const &,double)" (?projectPoints@cv@@YAXABV_InputArray@1@0000ABV_OutputArray@1@1N@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: unresolved external symbol ""bool __cdecl cv::solvePnP(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,class cv::_OutputArray const &,bool,int)" (?solvePnP@cv@@YA_NABV_InputArray@1@000ABV_OutputArray@1@1_NH@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: unresolved external symbol ""bool __cdecl cv::findChessboardCorners(class cv::_InputArray const &,class cv::Size_<int>,class cv::_OutputArray const &,int)" (?findChessboardCorners@cv@@YA_NABV_InputArray@1@V?$Size_@H@1@ABV_OutputArray@1@H@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".

my .pro-file

QT       += core gui widgets
TARGET = beispiel
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

INCLUDEPATH += C:/opencv/build/include/

LIBS += -LC:/opencv/build/x64/vc12/lib \
        -lopencv_calib3d249 \
        -lopencv_core249 \
        -lopencv_highgui249 \
        -lopencv_imgproc249

I installed opencv3.0 hoping that will fix it but it didn't.

Any help will be appreciated.


now I lost everything.

I cleaned and re-build the project. now I get 16 Linking errors.

mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""private: char * __thiscall cv::String::allocate(unsigned int)" (?allocate@String@cv@@AAEPADI@Z)" in Funktion ""public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat@cv@@QAE@HHHPAXI@Z)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""private: void __thiscall cv::String::deallocate(void)" (?deallocate@String@cv@@AAEXXZ)" in Funktion ""public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat@cv@@QAE@HHHPAXI@Z)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::error(int,class cv::String const &,char const *,char const *,int)" (?error@cv@@YAXHABVString@1@PBD1H@Z)" in Funktion ""public: __thiscall cv::Mat::Mat(int,int,int,void *,unsigned int)" (??0Mat@cv@@QAE@HHHPAXI@Z)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class cv::_InputOutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAABV_InputOutputArray@1@XZ)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual bool __thiscall cv::FileStorage::open(class cv::String const &,int,class cv::String const &)" (?open@FileStorage@cv@@UAE_NABVString@2@H0@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::findContours(class cv::_InputOutputArray const &,class cv::_OutputArray const &,int,int,class cv::Point_<int>)" (?findContours@cv@@YAXABV_InputOutputArray@1@ABV_OutputArray@1@HHV?$Point_@H@1@@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::line(class cv::_InputOutputArray const &,class cv::Point_<int>,class cv::Point_<int>,class cv::Scalar_<double> const &,int,int,int)" (?line@cv@@YAXABV_InputOutputArray@1@V?$Point_@H@1@1ABV?$Scalar_@N@1@HHH@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::circle(class cv::_InputOutputArray const &,class cv::Point_<int>,int,class cv::Scalar_<double> const &,int,int,int)" (?circle@cv@@YAXABV_InputOutputArray@1@V?$Point_@H@1@HABV?$Scalar_@N@1@HHH@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::ellipse(class cv::_InputOutputArray const &,class cv::Point_<int>,class cv::Size_<int>,double,double,double,class cv::Scalar_<double> const &,int,int,int)" (?ellipse@cv@@YAXABV_InputOutputArray@1@V?$Point_@H@1@V?$Size_@H@1@NNNABV?$Scalar_@N@1@HHH@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::ellipse(class cv::_InputOutputArray const &,class cv::RotatedRect const &,class cv::Scalar_<double> const &,int,int)" (?ellipse@cv@@YAXABV_InputOutputArray@1@ABVRotatedRect@1@ABV?$Scalar_@N@1@HH@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::projectPoints(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,class cv::_OutputArray const &,double)" (?projectPoints@cv@@YAXABV_InputArray@1@0000ABV_OutputArray@1@1N@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""bool __cdecl cv::solvePnP(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,class cv::_OutputArray const &,bool,int)" (?solvePnP@cv@@YA_NABV_InputArray@1@000ABV_OutputArray@1@1_NH@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""bool __cdecl cv::findChessboardCorners(class cv::_InputArray const &,class cv::Size_<int>,class cv::_OutputArray const &,int)" (?findChessboardCorners@cv@@YA_NABV_InputArray@1@V?$Size_@H@1@ABV_OutputArray@1@H@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual bool __thiscall cv::VideoCapture::read(class cv::_OutputArray const &)" (?read@VideoCapture@cv@@UAE_NABV_OutputArray@2@@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::namedWindow(class cv::String const &,int)" (?namedWindow@cv@@YAXABVString@1@H@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".
mainwindow.obj:-1: error: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl cv::imshow(class cv::String const &,class cv::_InputArray const &)" (?imshow@cv@@YAXABVString@1@ABV_InputArray@1@@Z)" in Funktion ""private: int __thiscall MainWindow::on_ButtonVideo_clicked(void)" (?on_ButtonVideo_clicked@MainWindow@@AAEHXZ)".

this my entire code:

#include "mainwindow.h"

using namespace cv;
using namespace std;
Point prevCenter_bl;
Point prevCenter_gr;
Point prevCenter_rd;
int boardHeight = 6;
int boardWidth = 9;
Size cbSize = Size(boardHeight,boardWidth);

string filename = "out_camera_data.yml";
//default image size
const int FRAME_WIDTH = 640;
const int FRAME_HEIGHT = 480;

//function prototypes
//void generate_boardPoints();

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->ButtonVideo, SIGNAL(clicked()), this, SLOT(on_ButtonVideo_clicked()) );
    connect(ui->ButtonVideoRelease, SIGNAL(clicked()), this, SLOT(on_ButtonVideoRelease_clicked()) );
  //  connect(ui->videoFrame, SIGNAL(clicked()), this, SLOT(on_ButtonVideoRelease_clicked()) );
}

MainWindow::~MainWindow()
{
    delete ui;
}


int MainWindow::on_ButtonVideo_clicked()
{
    ///init_chess_board
    //set up a FileStorage object to read camera params from file
    FileStorage fs;
    fs.open(filename, FileStorage::READ);
    // read camera matrix and distortion coefficients from file
    Mat intrinsics, distortion;
    fs["Camera_Matrix"] >> intrinsics;
    fs["Distortion_Coefficients"] >> distortion;
    // close the input file
    fs.release();

    //set up matrices for storage
    Mat webcamImage, gray, one;
    Mat rvec = Mat(Size(3,1), CV_64F);
    Mat tvec = Mat(Size(3,1), CV_64F);

    //setup vectors to hold the chessboard corners in the chessboard coordinate system and in the image
    vector<Point2d> imagePoints, imageFramePoints, imageOrigin;
    vector<Point3d> boardPoints, framePoints;

    //generate vectors for the points on the chessboard
    for (int i=0; i<boardWidth; i++)
    {
        for (int j=0; j<boardHeight; j++)
        {
            boardPoints.push_back( Point3d( double(i), double(j), 0.0) );
        }
    }
    //generate points in the reference frame
    framePoints.push_back( Point3d( 0.0, 0.0, 0.0 ) );
    framePoints.push_back( Point3d( 5.0, 0.0, 0.0 ) );
    framePoints.push_back( Point3d( 0.0, 5.0, 0.0 ) );
    framePoints.push_back( Point3d( 0.0, 0.0, 5.0 ) );


    ///init_ellipse_tracking
//    namedWindow("Control"); //create a window called "Control"
    int iLowH_bl = 104;      //0
    int iHighH_bl = 179;   //179
    int iLowS_bl = 86;      //0
    int iHighS_bl = 255;   //255
    int iLowV_bl = 0;      //0
    int iHighV_bl = 255;   //255
    int sliderPos_bl = 70; //70

    int iLowH_gr = 87;      //0
    int iHighH_gr = 102;   //179
    int iLowS_gr = 108;      //0
    int iHighS_gr = 238;   //255
    int iLowV_gr = 78;      //0
    int iHighV_gr = 175;   //255
    int sliderPos_gr = 70; //70

    int iLowH_rd = 0;      //0
    int iHighH_rd = 34;   //179
    int iLowS_rd = 68;      //0
    int iHighS_rd = 255;   //255
    int iLowV_rd = 58;      //0
    int iHighV_rd = 117;   //255
    int sliderPos_rd = 70; //70

    //Create trackbars in "Control" window
//    cvCreateTrackbar("LowH", "Control", &iLowH, 179); //Hue (0 - 179)
//    cvCreateTrackbar("HighH", "Control", &iHighH, 179);
//    cvCreateTrackbar("LowS", "Control", &iLowS, 255); //Saturation (0 - 255)
//    cvCreateTrackbar("HighS", "Control", &iHighS, 255);
//    cvCreateTrackbar("LowV", "Control", &iLowV, 255); //Value (0 - 255)
//    cvCreateTrackbar("HighV", "Control", &iHighV, 255);
    //cvCreateTrackbar("Ellipse", "Control", &sliderPos, 255);

//    cvResizeWindow("Control", 220, 50);

    Mat imgOriginal;
    VideoCapture cap(0); //capture the video from web cam
    capture.set(CV_CAP_PROP_FRAME_WIDTH,FRAME_WIDTH);
    capture.set(CV_CAP_PROP_FRAME_HEIGHT,FRAME_HEIGHT);
    if ( !cap.isOpened() )  // if not success, exit program
    {
        cout << "Cannot open the web cam" << endl;
        return -1;
    }


    while (true)
    {
         /// chess_board
         //store image to matrix
         capture.read(webcamImage);

         //make a gray copy of the webcam image
         cvtColor(webcamImage,gray,COLOR_BGR2GRAY);


         //detect chessboard corners
         bool found = findChessboardCorners(gray, cbSize, imagePoints, CALIB_CB_FAST_CHECK);
         //drawChessboardCorners(webcamImage, cbSize, Mat(imagePoints), found);



         //find camera orientation if the chessboard corners have been found
         if ( found )
         {
             //find the camera extrinsic parameters
             solvePnP( Mat(boardPoints), Mat(imagePoints), intrinsics, distortion, rvec, tvec, false );

             //project the reference frame onto the image
             projectPoints(framePoints, rvec, tvec, intrinsics, distortion, imageFramePoints );


             //DRAWING
             //draw the reference frame on the image
             circle(webcamImage, (Point) imagePoints[0], 4 ,CV_RGB(255,0,0) );

             Point one, two, three;
             one.x=10; one.y=10;
             two.x = 60; two.y = 10;
             three.x = 10; three.y = 60;

             line(webcamImage, one, two, CV_RGB(255,0,0) );
             line(webcamImage, one, three, CV_RGB(0,255,0) );


             line(webcamImage, imageFramePoints[0], imageFramePoints[1], CV_RGB(255,0,0), 2 );
             line(webcamImage, imageFramePoints[0], imageFramePoints[2], CV_RGB(0,255,0), 2 );
             line(webcamImage, imageFramePoints[0], imageFramePoints[3], CV_RGB(0,0,255), 2 );



             //show the pose estimation data
             cout << fixed << setprecision(2) << "rvec = ["
                  << rvec.at<double>(0,0) << ", "
                  << rvec.at<double>(1,0) << ", "
                  << rvec.at<double>(2,0) << "] \t" << "tvec = ["
                  << tvec.at<double>(0,0) << ", "
                  << tvec.at<double>(1,0) << ", "
                  << tvec.at<double>(2,0) << "]" << endl;

         }

         //show the image on screen
         namedWindow("OpenCV Webcam", 0);
         imshow("OpenCV Webcam", webcamImage);


         //show the gray image
         //namedWindow("Gray Image", CV_WINDOW_AUTOSIZE);
         //imshow("Gray Image", gray);

        /// ellipse_tracking
        bool bSuccess = cap.read(imgOriginal); // read a new frame from video
        if (!bSuccess) //if not success, break loop
        {
             cout << "Cannot read a frame from video stream" << endl;
             break;
        }
        Mat imgHSV_bl;
        Mat imgHSV_gr;
        Mat imgHSV_rd;
        cvtColor(imgOriginal, imgHSV_bl, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV
        cvtColor(imgOriginal, imgHSV_gr, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV
        cvtColor(imgOriginal, imgHSV_rd, COLOR_BGR2HSV); //Convert the captured frame from BGR to HSV
        Mat imgThresholded_bl;
        Mat imgThresholded_gr;
        Mat imgThresholded_rd;
        inRange(imgHSV_bl, Scalar(iLowH_bl, iLowS_bl, iLowV_bl), Scalar(iHighH_bl, iHighS_bl, iHighV_bl), imgThresholded_bl); //Threshold the image
        inRange(imgHSV_gr, Scalar(iLowH_gr, iLowS_gr, iLowV_gr), Scalar(iHighH_gr, iHighS_gr, iHighV_gr), imgThresholded_gr); //Threshold the image
        inRange(imgHSV_rd, Scalar(iLowH_rd, iLowS_rd, iLowV_rd), Scalar(iHighH_rd, iHighS_rd, iHighV_rd), imgThresholded_rd); //Threshold the image

        //morphological opening (remove small objects from the foreground)
        erode(imgThresholded_bl, imgThresholded_bl, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        erode(imgThresholded_gr, imgThresholded_gr, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        erode(imgThresholded_rd, imgThresholded_rd, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        dilate( imgThresholded_bl, imgThresholded_bl, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        dilate( imgThresholded_gr, imgThresholded_gr, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        dilate( imgThresholded_rd, imgThresholded_rd, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );

        //morphological closing (fill small holes in the foreground)
        dilate( imgThresholded_bl, imgThresholded_bl, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        dilate( imgThresholded_gr, imgThresholded_gr, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        dilate( imgThresholded_rd, imgThresholded_rd, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        erode(imgThresholded_bl, imgThresholded_bl, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        erode(imgThresholded_gr, imgThresholded_gr, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );
        erode(imgThresholded_rd, imgThresholded_rd, getStructuringElement(MORPH_ELLIPSE, Size(5, 5)) );

//        imshow("Thresholded Image Blue", imgThresholded_bl); //show the thresholded image
//        imshow("Thresholded Image Green", imgThresholded_gr); //show the thresholded image
//        imshow("Thresholded Image Red", imgThresholded_rd); //show the thresholded image
        //imshow("Original", imgOriginal); //show the original image

        ///#### End sticker color selection ####

        vector<vector<Point> > contours_bl;
        vector<vector<Point> > contours_gr;
        vector<vector<Point> > contours_rd;
           Mat bimage_bl = imgThresholded_bl >= sliderPos_bl;
           Mat bimage_gr = imgThresholded_gr >= sliderPos_gr;
           Mat bimage_rd = imgThresholded_rd >= sliderPos_rd;

           findContours(bimage_bl, contours_bl, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
           findContours(bimage_gr, contours_gr, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
           findContours(bimage_rd, contours_rd, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

           for(size_t i = 0; i < contours_bl.size(); i++){
               size_t count = contours_bl[i].size();
               if( count < 6 )
                   continue;
               Mat pointsf;
               Mat(contours_bl[i]).convertTo(pointsf, CV_32F);
               RotatedRect box = fitEllipse(pointsf);
               prevCenter_bl.x = box.center.x;
               prevCenter_bl.y = box.center.y;
               ellipse(imgOriginal, box, Scalar(0,0,255), 1, CV_AA);
               ellipse(imgOriginal, box.center, box.size*0.0001f, box.angle, 0, 360, Scalar(0,255,255), 1, CV_AA);

               line(imgOriginal, box.center, prevCenter_gr, cv::Scalar(0,255,0), 1, CV_AA);

           }
           for(size_t i = 0; i < contours_gr.size(); i++){
               size_t count = contours_gr[i].size();
               if( count < 6 )
                   continue;
               Mat pointsf;
               Mat(contours_gr[i]).convertTo(pointsf, CV_32F);
               RotatedRect box = fitEllipse(pointsf);
               prevCenter_gr.x = box.center.x;
               prevCenter_gr.y = box.center.y;
               ellipse(imgOriginal, box, Scalar(0,0,255), 1, CV_AA);
               ellipse(imgOriginal, box.center, box.size*0.0001f, box.angle, 0, 360, Scalar(0,255,255), 1, CV_AA);

               line(imgOriginal, box.center, prevCenter_rd, cv::Scalar(0,255,0), 1, CV_AA);

           }
           for(size_t i = 0; i < contours_rd.size(); i++){
               size_t count = contours_rd[i].size();
               if( count < 6 )
                   continue;
               Mat pointsf;
               Mat(contours_rd[i]).convertTo(pointsf, CV_32F);
               RotatedRect box = fitEllipse(pointsf);
               prevCenter_rd.x = box.center.x;
               prevCenter_rd.y = box.center.y;
               ellipse(imgOriginal, box, Scalar(0,0,255), 1, CV_AA);
               ellipse(imgOriginal, box.center, box.size*0.0001f, box.angle, 0, 360, Scalar(0,255,255), 1, CV_AA);

               line(imgOriginal, box.center, prevCenter_bl, cv::Scalar(0,255,0), 1, CV_AA);

           }
           imshow("result", imgOriginal);
           waitKey(10);
    }
          return 0;

}

void MainWindow::on_ButtonVideoRelease_clicked()
{
    if(capture.isOpened())
    capture.release();
}

the header:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <opencv2/opencv.hpp>
#include <opencv/cv.hpp>
#include "ui_mainwindow.h"
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <iostream>
#include <stdio.h>
#include <string>
#include <iomanip>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    cv::VideoCapture capture;

private slots:
    int on_ButtonVideo_clicked();
    void on_ButtonVideoRelease_clicked();
};

#endif // MAINWINDOW_H

and the .pro

QT       += core gui widgets

TARGET = beispiel
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

INCLUDEPATH += C:/opencv/build/include/

LIBS += -LC:/opencv/build/x64/vc12/lib \
        -lopencv_calib3d249 \
        -lopencv_core249 \
        -lopencv_highgui249 \
        -lopencv_imgproc249 \

it's still the same. I have both opencv 2.4.9. and 3.0 installed, so there are those libs in the folder C:/opencv/build/x64/vc12/lib and C:/opencv/build/x64/vc12/staticlib.

what's the difference between lib and staticlib? can anyone help pls?

1

There are 1 answers

0
Marged On

You are trying to link one or more libraries that don't exist:

opencv_calib3d249

When I check the contents of the OpenCV 3.0 sfx I can only see these libraries:

opencv\build\x64\vc11\staticlib\opencv_calib3d300.lib
opencv\build\x64\vc12\staticlib\opencv_calib3d300.lib
opencv\build\x86\vc11\staticlib\opencv_calib3d300.lib
opencv\build\x86\vc12\staticlib\opencv_calib3d300.lib

So it seems to me that both the path to the libs (C:/opencv/build/x64/vc12/lib) and the version number in the files (249) are not correct.

If you want to look inside the .lib files you reference in order to find out which methods they export, use a command similar to this:

dumpbin opencv_calib3d300.lib /symbols

Dumpbin is part of Visual Studio, there is plenty of information available on SO, for example here.