Hadi GhahremanNezhad
Hadi GhahremanNezhad

Reputation: 2445

Qt creator does not detect opencv

I am trying to run a program in Qt5.6 with openCV3.1, but no matter what I do, it does not detect openCV include.

Projects -> Build Environment -> Include : I added C:\opencv\opencv3.1.0\opencv\build\include

Projects -> Build Environment -> LIB: I added C:\opencv\opencv3.1.0\opencv\build\x64\vc14\lib

However, still in the code there is a yellow line indicating that it doesn't detect opencv:

enter image description here

and there are lots of errors like this:

enter image description here

The environment variable for openCV is also set as:

C:\opencv\opencv3.1.0\opencv\build

How should I install Qt with openCV to avoid these problems?

Upvotes: 0

Views: 387

Answers (1)

Bahramdun Adil
Bahramdun Adil

Reputation: 6079

In the .pro file, add the following lines:

INCLUDEPATH += C:\opencv\opencv3.1.0\opencv\build\include
LIBS += -LC:\opencv\opencv3.1.0\opencv\build\x64\vc14\lib \
    opencv310.lib \

And also you need to add the .dll file's path C:\opencv\opencv3.1.0\opencv\build\x64\vc14\bin to the system path (this time you need to restart the Qt IDE)

Upvotes: 1

Related Questions