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 <QDialog>

    namespace Ui {
    class Dialog;

    class Dialog : public QDialog

    explicit Dialog(QWidget *parent = 0);

    public slots:
    void processFrameAndUpdateGUI();

    private slots:
    void on_btnPauseOrResume_clicked();

    Ui::Dialog *ui;

    // Declare variables while linking them to opencv libraries

    error message
    error: opencv2/core/core.hpp: No such file or directory

  • 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

    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


    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.