# Install Opencv and QT (no tutorial worked yet)

**URL:** <https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942>\
**Category:** C++\
**Tags:** qt\
**Created:** [April 23, 2021, 11:06am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942 "2021-04-23T11:06:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 23, 2021, 11:06am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/1 "2021-04-23T11:06:46Z")

</div>

Hello,

I know this question was asked many times. I tried at least as often as this quesition was asked to run opencv on QT.

I tried three full days by now. I really did not want to ask in here but I think I am really stuck. I tried almost any tutorial (with cmake or without, mingw or msvc), tried 64 Bit and 32 Bit, downloaded severeal QT and opencv Versions (the versions used in the tutorials).

Sometimes I ran into errors while compiling with mingw32 (on command line), sometimes within cmake, and more often in QT itself. (Could not find modules.hpp/core.hpp…etc, unreferenced object cv, Mat , etc etc)

I would just like to use opencv on a 32 Bit qt application. Never mind which version of opencv or qt.

Does anyone has a working solution (I maybe did not tried yet)? Or could help with specific errors on specific procedurs.

I would be so happy.  
Thanks a lot in advance,.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 23, 2021, 11:43am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/2 "2021-04-23T11:43:41Z")

</div>

sorry, but we won’t / can’t write a tutorial for you.

and if you need help, you need to show us the exact steps taken, and the precise error resulting (you have all our sympathy, but whining does NOT help here)

and maybe it’s a good idea to start with building opencv only, once that works, add qt.

---

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 23, 2021, 11:49am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/3 "2021-04-23T11:49:37Z")

</div>

I already build opencv with visual studio - this works

It is just that no tutorial works for me. Maybe you know a more recent tutorial I could follow.

Or maybe you have a fully build (with cmake) folder with everything I need so I could use this one. Maybe something like this even exists on github or somewhere else. I just cant find it

Just one example (but this is already obvious why it wont work)  
When I follow [this tutorial](https://amin-ahmadi.com/2019/06/29/configuring-qt-for-windows-projects-to-use-opencv-4-1-0/) qt cant find any of the lib files. Which is obvious because I cant find them too. I just downloaded the default folder (like advised) and then I include everything like wanted but receive many errors.

Another examples (other tutorials) that I get a linker error because I refer to unreferenced objects). Which I do not understand since I did everything what they told me in the tutorial.

[other tutorial](https://www.youtube.com/watch?v=akAAAvGyLn0)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 23, 2021, 11:56am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/4 "2021-04-23T11:56:22Z")

</div>

sorry to say so, but “how to compile qt using mingw” is somewhat off-topic here.

we _can_ however help building opencv, if you give us the required information

---

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 23, 2021, 11:57am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/5 "2021-04-23T11:57:54Z")

</div>

what information can I give you?

I just wanted to try this forum. Sorry if this is too offtopic. I will delete my question then.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 23, 2021, 11:59am UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/6 "2021-04-23T11:59:31Z")

</div>

> [@tim5](#):
>
> what information can I give you?

- os / compiler used
- cmake cmdline / console output
- make output (if you got that far)
- resulting errors / problems

---

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 23, 2021, 12:09pm UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/7 "2021-04-23T12:09:35Z")

</div>

If I get to the point (without errors on command line or cmake) I always get these errors for example. I will try a few tutorials again and document the erros.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/3/38ea0118d87a2888142c56d842b53c854859231c.png)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 23, 2021, 12:12pm UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/8 "2021-04-23T12:12:25Z")

</div>

your ide is misconfigured, you’re not **linking** opencv libs

(and please, spare us further screenshots of code or errors, they’re useless, can’t be searched, indexed, etc , post TEXT instead, thank you)

---

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 23, 2021, 3:30pm UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/9 "2021-04-23T15:30:43Z")

</div>

I tried [this tutorial](https://www.youtube.com/watch?v=NwLkwfCt9mM) and received the same errors.

I used mingw32 Bit compiler, cmake-3.19.8-win32-x86.msi.  
Command line: mingw32-make

I linked the libraries (as told in the tutorial) trough a .pri file (I also tried the other direct way).

error: undefined reference to ‘cv::fastFree(void\*)’

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 23, 2021, 4:02pm UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/10 "2021-04-23T16:02:00Z")

</div>

sorry, but mentioning (video) tutorials does not help, we need to see what YOU did, not someone else

> [@tim5](#):
>
> I linked the libraries

hopefully that means, that you _built_ those before (using cmake /mingw32-make)  
check ?

> [@tim5](#):
>
> trough a .pri file

you probably meant a .pro file, but where is it ? we need to SEEEE it, if you need help with it

> [@tim5](#):
>
> error: undefined reference to ‘cv::fastFree(void\*)’

means, you do not link against opencv\_core452 (or opencv\_world452) correctly

---

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.opencv.org/u/tim5)\
**Post date:** [April 23, 2021, 8:41pm UTC](https://forum.opencv.org/t/install-opencv-and-qt-no-tutorial-worked-yet/2942/11 "2021-04-23T20:41:50Z")

</div>

> this is the .pri file  
> INCLUDEPATH += C:\opencv-3.4.3\build\install\include2   
> LIBS += -L"C:\opencv-3.4.3\build\install\x86\mingw\bin"  
> libopencv\_aruco343   
> libopencv\_bgsegm343   
> libopencv\_bioinspired343   
> libopencv\_calib3d343   
> libopencv\_ccalib343   
> libopencv\_core343   
> libopencv\_cvv343   
> libopencv\_datasets343   
> libopencv\_dnn\_objdetect343   
> libopencv\_dnn343   
> libopencv\_dpm343   
> libopencv\_face343   
> libopencv\_features2d343   
> libopencv\_flann343   
> libopencv\_fuzzy343   
> libopencv\_hfs343   
> libopencv\_highgui343   
> libopencv\_img\_hash343   
> libopencv\_imgcodecs343   
> libopencv\_imgproc343   
> libopencv\_line\_descriptor343   
> libopencv\_ml343   
> libopencv\_objdetect343   
> libopencv\_optflow343   
> libopencv\_phase\_unwrapping343   
> libopencv\_photo343   
> libopencv\_plot343   
> libopencv\_reg343   
> libopencv\_rgbd343   
> libopencv\_saliency343   
> libopencv\_shape343   
> libopencv\_stereo343   
> libopencv\_stitching343   
> libopencv\_structured\_light343   
> libopencv\_superres343   
> libopencv\_surface\_matching343   
> libopencv\_text343   
> libopencv\_tracking343   
> libopencv\_video343   
> libopencv\_videoio343   
> libopencv\_videostab343   
> libopencv\_xfeatures2d343   
> libopencv\_ximgproc343   
> libopencv\_xobjdetect343   
> libopencv\_xphoto343
