Linking OpenCV 3.2.0 library with Qt 5.4



  • I had downloaded the libraries for OpenCV and wanted to connect it to Qt for my project. I am doing this on Windows 10. I want to develop a GUI that would be able to upload and play video. But I have an error saying that "No such file or directory"

    .pro file
    INCLUDEPATH += C:/opencv-3.2.0-vc14/opencv/build/include/opencv2

    LIBS += LC:/opencv-3.2.0-vc14/opencv/build/bin -libopencv_core -libopencv_imgproc -libopencv_highgui

    header file
    #ifndef DIALOG_H
    #define DIALOG_H

    #include<opencv2/core/core.hpp>
    #include<opencv2/highgui/highgui.hpp>
    #include<opencv2/imgproc/imgproc.hpp>
    #include<opencv2/core/types.hpp>

    #include <QDialog>

    namespace Ui {
    class Dialog;
    }

    class Dialog : public QDialog
    {
    Q_OBJECT

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

    public slots:
    void processFrameAndUpdateGUI();

    private slots:
    void on_btnPauseOrResume_clicked();

    private:
    Ui::Dialog *ui;

    // Declare variables while linking them to opencv libraries
    

    error message
    error: opencv2/core/core.hpp: No such file or directory
    #include<opencv2/core/core.hpp>
    ^


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Remove the opencv2 at the end of your INCLUDEPATH statement.



  • Hi @SGaist

    Now this error appears
    error: error: LC:/opencv-3.2.0-vc14/opencv/build/bin: Invalid argument


  • Qt Champions 2016

    @Syazwany
    And you are using the same compiler for your app ?
    (visual studio 2015 i think it is)


  • Lifetime Qt Champion

    You are missing a - before the L in your LIBS statement.



  • @mrjj Hi, I am using MinGW compiler. I am new to this and been dealing with this error for more than a week now :(


  • Moderators

    @Syazwany As already mentioned you're missing - in front of L:

    LIBS += -LC:/opencv-3.2.0-vc14/opencv/build/bin -libopencv_core -libopencv_imgproc -libopencv_highgui
    


  • @SGaist Still does not work, the same error :(


  • Qt Champions 2016

    Hi

    But if you are using mingw compiler and that opencv-3.2.0-vc14 really sounds like visual studio compiler.

    Are we not trying to use visual studio DLLS with mingw compiler ?

    I assume you did not build openCV yourself but just downloaded and unpacked it ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.