Qt problem to include opencv library



  • Hello,

    I have Qt 5.2.1 Windows & vs11 compiler (x86), this is my .pro file :
    @
    SOURCES = facerecognitiondemo.cpp main.cpp
    HEADERS = facerecognitiondemo.h
    FORMS = facerecognitiondemo.ui

    target.path = $$[QT_INSTALL_EXAMPLES]/uitools/FaceRecognitionDemo
    INSTALLS += target

    QT += widgets

    OPENCV_PATH = E:\opencv

    LIBS_PATH = "$$OPENCV_PATH/build/x86/vc11/lib"

    CONFIG(debug, debug|release) {
    LIBS     += -L$$LIBS_PATH \
                -lopencv_core246d \
                -lopencv_highgui246d \
                -lopencv_objdetect246d
    }
    
    CONFIG(release, debug|release) {
    LIBS     += -L$$LIBS_PATH \
                -lopencv_core246 \
                -lopencv_highgui246 \
                -lopencv_objdetect246
    }
    

    @
    When i build i get this error :
    E:\Qt\qt5.2.1\Tools\qtcreator\bin\facerecognitiondemo\frdb.h:9: error: C1083: Cannot open include file: 'opencv/cxcore.h': No such file or directory



  • you should add

    @INCLUDEPATH += $$OPENCV_PATH/src/include@

    maybe src is not needed, take a look in the directory where to find:

    "opencv/cxcore.h"



  • [quote author="hpollak" date="1395215900"]you should add

    @INCLUDEPATH += $$OPENCV_PATH/src/include@

    maybe src is not needed, take a look in the directory where to find:

    "opencv/cxcore.h"

    [/quote]
    it's not working this is the full path
    @E:\opencv\build\include\opencv@



  • Qt 5.2.1
    this is the full project
    https://www.dropbox.com/s/hmbl3e8hj7ygq4a/FaceRecognitionDemo.rar
    and this is the opencv directories (opencv 2.4.8 windows):
    E:\opencv\build
    E:\opencv\sources



  • In you project file you put
    @
    INCLUDEPATH += E:\opencv\build\include
    @

    And in you sources you use
    @
    #include <cxcore.h>
    @

    You should change either INCLUDEPATH
    @
    INCLUDEPATH += E:\opencv\build\include\opencv
    @

    or #include directive
    @
    #include <opencv/cxcore.h>
    @


Log in to reply
 

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