Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved 'opencv2/opencv.hpp' file not found

    General and Desktop
    opencv c++ opencv cpp
    3
    5
    3927
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      blackbox last edited by

      Dear all,
      I want to use openCV with Qt but I get this error:

      'opencv2/opencv.hpp' file not found
       'opencv2/highgui.hpp' file not found
       'opencv2/core.hpp' file not found
      

      so Qt does not know where these files are located. I added them manually.

      Finally my .pro file is:

      QT       += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      CONFIG += c++11
      
      SOURCES += \
          main.cpp \
      
      HEADERS += \
          main.h
      
      FORMS += \
          main.ui
      
      LIBS += -L/usr/local/Cellar/opencv/4.4.0_2/lib \
           -lopencv_core \
           -lopencv_highgui
      
      INCLUDEPATH += \
               /usr/local/include
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      

      I know this is one of the most encountered problem for users new to Qt. I searched well the problem but nothing solved it. I am sure the path of libraries is correct because I have already used openCV libs in Xcode.

      openCV is the latest version: 4.4.0. Is the latest version not appropriate for Qt? What do you think? I reinstalled it but nothing changes. And it is not an easy task to remove openCV and degrade its version i think.

      Any suggestion?

      Thank you for your time and attention.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        Where exactly are those file located on your machine ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • B
          blackbox last edited by

          They are located in:

          /usr/local/Cellar/opencv/4.4.0_2/lib
          

          as I write them in 'LIBS' in my .pro file.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            I meant the header files since those are the ones currently not found.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 1
            • S
              SilentWolf last edited by

              Lack INCLUDEPATH such as:
              INCLUDEPATH += /usr/local/include

              1 Reply Last reply Reply Quote 0
              • First post
                Last post