Results 1 to 9 of 9

Thread: qt is not able to locate header files of opencv

  1. #1
    Join Date
    Nov 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Question qt is not able to locate header files of opencv

    hello people
    I m new to qt and opencv. from the last 24 hours i m trying to link qt with opencv. i have read all the related posts on this forum. but nothing worked out. plz someone help me.
    plz tell me why qt is not able to locate the header files of opencv.

    the procedure i adopted is given as follows:
    1. downloaded opencv 2.3.1, qtsdk 4.7.4 and cmake 2.8.
    2. generated binary files of opencv by following the tutorial http://knowtheabc.wordpress.com/2011...nd-qt-creator/
    3. initially i extracted opencv files in the folder named as "opencv" located at C:\Program Files\opencv. Then i
    generated binary files in the folder named as "opencv_binary" located at C:\Program Files\opencv_binary.
    4. when the binary files got generated i copied the folder "opencv_binary" in "opencv" itself.
    5. now after writing the code i modified .pro file as follows:
    i appended the following code to .pro file:
    INCLUDEPATH += C:\Program Files\opencv\include\opencv\
    LIBS += -LC:\Program Files\opencv\opencv_binary\lib\
    -lopencv_core220 \
    -lopencv_highgui220 \
    -lopencv_imgproc220 \
    -lopencv_features2d220 \
    -lopencv_calib3d220
    6. and the header files i am using are like this:
    #include "cv.h"
    #include "cvaux.h"
    #include "highgui.h"
    7. now when i build this project it says "no such file or directory exist".
    8. Also i have changed the PATH variable to include C:\QtSDK\mingw\bin;C:\Program Files\opencv\opencv_binary\bin;

    I don know whats wrong with these steps. someone please help. I am working on a final year project and have to submit it by the day after tomorrow. Its really urgent. Please HELP!!

  2. #2
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qt is not able to locate header files of opencv

    Try
    Qt Code:
    1. INCLUDEPATH += "C:\Program Files\opencv\include\opencv"
    2. LIBS += -L"C:\Program Files\opencv\opencv_binary\lib" \
    3. -lopencv_core220 \
    4. -lopencv_highgui220 \
    5. -lopencv_imgproc220 \
    6. -lopencv_features2d220 \
    7. -lopencv_calib3d220
    To copy to clipboard, switch view to plain text mode 
    Oleg Shparber

  3. #3
    Join Date
    Nov 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qt is not able to locate header files of opencv

    I tried it but it din't work.
    Plz giv some more suggestions..

  4. #4
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qt is not able to locate header files of opencv

    Actually it should work, if the paths are correct.
    Have you rerun qmake after changing .pro?
    Oleg Shparber

  5. #5
    Join Date
    Nov 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qt is not able to locate header files of opencv

    umm..i have rebuilt it. But i dint get what do u mean by "re-run qmake"

  6. #6
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qt is not able to locate header files of opencv

    After changing pro file you should run qmake again to have correct makefiles. Right click on your project and select "Run qmake".
    Oleg Shparber

  7. #7
    Join Date
    Nov 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qt is not able to locate header files of opencv

    yes i followed it..but still it is not working

  8. #8
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qt is not able to locate header files of opencv

    OK, I can't say what is wrong, but having spaces in include/lib paths isn't good (although it should work with quotes). Try to move include dir to somewhere like c:\opencv, then change .pro file:
    Qt Code:
    1. INCLUDEPATH += c:/opencv/include
    To copy to clipboard, switch view to plain text mode 
    and in your sources use:
    Qt Code:
    1. #include <opencv/cv.h>
    2. #include <opencv/cvaux.h>
    3. #include <opencv/highgui.h>
    To copy to clipboard, switch view to plain text mode 
    It should find headers fine. At least it works for me in such way in my projects.
    Oleg Shparber

  9. #9
    Join Date
    Nov 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qt is not able to locate header files of opencv

    thanx Oleg Shparber!
    My problem is solved.

Similar Threads

  1. Qt header files suggestion
    By chandan in forum Newbie
    Replies: 3
    Last Post: 1st March 2011, 11:23
  2. Header Files
    By Maluko_Da_Tola in forum Newbie
    Replies: 1
    Last Post: 2nd October 2010, 13:04
  3. Replies: 2
    Last Post: 30th September 2010, 13:26
  4. Locate Class/Method from Dll hex address
    By sivrisinek in forum Installation and Deployment
    Replies: 5
    Last Post: 1st October 2009, 17:29
  5. header files problems
    By dognzhe in forum General Programming
    Replies: 1
    Last Post: 18th May 2009, 09:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.