# Which version of QT is compatible with opencv 4.5.4

**URL:** <https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950>\
**Category:** C++\
**Tags:** qt, build\
**Created:** [October 29, 2021, 6:42am UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950 "2021-10-29T06:42:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahdi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mahdi/32/3459_2.png) [@Mahdi](https://forum.opencv.org/u/Mahdi)\
**Post date:** [October 29, 2021, 6:42am UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950/1 "2021-10-29T06:42:45Z")

</div>

hi 🙂  
Which version of QT is compatible with opencv 4.5.4 ?  
[https://www.qt.io/download](https://www.qt.io/download)

for create button i want use this function `cv::createButton` but i cant! i must build opencv with QT

and how download opencv?  
i saw this link : [https://www.qt.io/offline-installers](https://www.qt.io/offline-installers)  
i downloaded this 3 packet :

1. Qt6 source packages [1.0 G]
2. 5.15.x source packages [962 MB]
3. 5.12.x Offline Installers [Windows Host, 3.7 GB]

But! None suitable for opencv cmake! I enabled this flag [WITH\_QT] and for this flag [Qt5\_DIR], i downloaded and extracted this QT [2) 5.15.x source packages] and set this directory I do:

```auto
F:\Windows\Programing\OpenCV\S.W\OpenCV\4.5.4\libraries\Extracted\qt-everywhere-src-5.15.2

```

Nothing happened when I pressed the ‘configuration’ and 'generate ’ buttons on cmake, tell me cmake again : Qt5\_DIR-NOTFOUND  
again i downloaded [Qt6 source packages] and exatract, again…

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

---

<div class="post-metadata">

**Author:** ![kbarni](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/kbarni/32/26_2.png) [@kbarni](https://forum.opencv.org/u/kbarni)\
**Post date:** [October 29, 2021, 8:25am UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950/2 "2021-10-29T08:25:30Z")

</div>

OpenCV is compatible with any QT5 or QT6 library.

But you need to **install** Qt, not just get those packages. Download the Qt online installer, chose a Qt library version and install it. It is correctly installed if you see the Qt creator in the Start menu.  
To double-check, you can try to build an example project from the Welcome screen.

Now cmake should find Qt.

If you still encounter problems, try to set manually the `Qt5_DIR` cmake flag to `[Qt install folder]/[Qt version]/[compiler]/lib/cmake/Qt5`

---

<div class="post-metadata">

**Author:** ![Mahdi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mahdi/32/3459_2.png) [@Mahdi](https://forum.opencv.org/u/Mahdi)\
**Post date:** [October 29, 2021, 4:17pm UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950/3 "2021-10-29T16:17:31Z")

</div>

I downloaded offline installer file [5.12.x Offline Installers, Windows Host, 3.7 GB]  
With your help, I set the path in cmake [Qt5\_DIR flag], In cmake I pressed the configure and then generate buttons, no problem occurred and everything was done correctly.  
i pressed “open project” button and build visual studio project, but show me 631 error!  
Where is my mistake?

All errors are from the opencv\_world project!

 ![Untitled](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/a/a9994ddedcdf8ce251ca8a9971605af3f5567277.png)

I disabled the BUILD\_opencv\_world flag in cmake → then build project in Visual Studio, all errors were from the opencv\_highgui project. [631 error again]

---

<div class="post-metadata">

**Author:** ![kbarni](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/kbarni/32/26_2.png) [@kbarni](https://forum.opencv.org/u/kbarni)\
**Post date:** [October 29, 2021, 8:26pm UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950/4 "2021-10-29T20:26:46Z")

</div>

I rarely use Windows, but it’s a link error concerning the Qt libraries. Check if all the folders related to Qt (like Qt5Gui\_DIR) was correctly configured in cmake.  
If it still gives errors, try to add the Qt5 lib files manually in Visual studio `Project settings -> Libraries`.

---

<div class="post-metadata">

**Author:** ![Mahdi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mahdi/32/3459_2.png) [@Mahdi](https://forum.opencv.org/u/Mahdi)\
**Post date:** [October 29, 2021, 8:29pm UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950/5 "2021-10-29T20:29:05Z")

</div>

yes all QT paths are correct (like Qt5Gui\_DIR)  
i change compiler? now i use mingw73\_64, now i go try this : msvc2017\_64

* * *

i use msvc2017\_64 and build opencv - no error! - for what? 😑

Why !!! After doing all this, I can not find QT dlls in this path :  
OpenCV\4.5.4\build\install\x64\vc16\bin  
note : i disabled this flag [BUILD\_opencv\_world]

for example i can find this 2 dll [Qt5Widgets.dll, Qt5Widgetsd.dll] in qt installation folder [C:\Qt\Qt5.12.11\5.12.11\msvc2017\_64], But I can not find them in the opencv installation folder!

---

<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:** [October 30, 2021, 7:10am UTC](https://forum.opencv.org/t/which-version-of-qt-is-compatible-with-opencv-4-5-4/5950/6 "2021-10-30T07:10:11Z")

</div>

> [@Mahdi](#):
>
> now i use mingw73\_64

then you have to _build_ the qt libs first for mingw
