2

I have downloaded qt-5.0.0 for windows.

http://releases.qt-project.org/qt5/5.0.1/qt-windows-opensource-5.0.1-msvc2010_32-x86-offline.exe

I have added INCLUDEPATH += C:\opencv\build\include in the .pro file.

Opencv 2.4.3 is already installed.

When I include header file in qtcreator :

#include <opencv2/opencv.hpp> 

There is compilation error : can not find opencv2/opencv.hpp

Any ideas ??

Barshan Das
  • 3,677
  • 4
  • 32
  • 46

5 Answers5

4

I found the solution. In Qt Creator, goto Projects on the left pane ( ctrl+5), then Build Environment -> Use System Environment, click on Details. Edit LIB variable. Add here.

Barshan Das
  • 3,677
  • 4
  • 32
  • 46
2

Things to check:

  • does C:\opencv\build\include\opencv2\opencv.hpp actually exist?
  • does the compile command (which you can check in the Qt Creator "compile output" window) show -IC:\opencv\build\include argument in the compile command?
  • qmake should be run automatically after modifying the .pro file, but re-run it manually just in case (for example from Build menu), as suggested by the first answer
  • this should not have any effect in issue like this, but just in case: if you are using "shadow build" (which is a good idea), make sure the source dir is clean of any generated files
hyde
  • 60,639
  • 21
  • 115
  • 176
0

The correct header files are:

<opencv2/core/core.hpp>
<opencv2/imgproc/imgproc.hpp>
<opencv2/highgui/highgui.hpp>

… and so on. The include of "opencv.h" is deprecated! It also does not work anymore for QtCreator auto-completion.

The solution is to update your sources to use the correct header files.

ypnos
  • 50,202
  • 14
  • 95
  • 141
0

After any change made to .pro file , Do right-click on project folder and click on run qmake .

ofskyMohsen
  • 1,121
  • 1
  • 12
  • 26
0

Well, I just ran into this problem tonight. luckily enough, after taking a fair time, the solution was found. If your project is managed by qmake, and Qcreator is used, just go to the Build->Run qmake, then build and run your project. A tip, whenever you change your *.pro file, remember to rerun Build->Run qmake, because that will reconfigure your project. If this helps you, please give me a thumb up :)