# QT mingwGM compile source code ERROR

**URL:** <https://forum.opencv.org/t/qt-mingwgm-compile-source-code-error/4399>\
**Category:** C++\
**Tags:** qt, build\
**Created:** [July 19, 2021, 8:50am UTC](https://forum.opencv.org/t/qt-mingwgm-compile-source-code-error/4399 "2021-07-19T08:50:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![szazone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/szazone/32/2704_2.png) [@szazone](https://forum.opencv.org/u/szazone)\
**Post date:** [July 19, 2021, 8:50am UTC](https://forum.opencv.org/t/qt-mingwgm-compile-source-code-error/4399/1 "2021-07-19T08:50:29Z")

</div>

I want use openCV with Qt in Windows, so I downloaded the sourse code of openCV 4.5.2. After I using CMake config compiler to mingwGM and generated the makefile, I tried to compile the code. I tried several time, but I can’t resolve this problem:

```auto
CMakeFiles\opencv_highgui.dir/objects.a(window.cpp.obj):window.cpp:(.text$cvSetWindowProperty+0x27): undefined reference to `cvSetPropVsync_W32(char const*, bool)'
CMakeFiles\opencv_highgui.dir/objects.a(window.cpp.obj):window.cpp:(.text$cvGetWindowProperty+0x36): undefined reference to `cvGetPropVsync_W32(char const*)'
CMakeFiles\opencv_highgui.dir/objects.a(window.cpp.obj):window.cpp:(.text$_ZN2cv17setWindowPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEid+0x5b): undefined reference to `cvSetPropVsync_W32(char const*, bool)'
CMakeFiles\opencv_highgui.dir/objects.a(window.cpp.obj):window.cpp:(.text$_ZN2cv17getWindowPropertyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi+0x91): undefined reference to `cvGetPropVsync_W32(char const*)'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:222: bin/libopencv_highgui452.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2684: modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2

```

My mingwGM version: 8.1.0  
My Qt version: 5.15.1  
My CMake version: 3.21.0

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [July 19, 2021, 6:09pm UTC](https://forum.opencv.org/t/qt-mingwgm-compile-source-code-error/4399/2 "2021-07-19T18:09:45Z")

</div>

**always** search for the error

- [4.5.2 static library, highgui module compile failure LNK2019 · Issue #19870 · opencv/opencv · GitHub](https://github.com/opencv/opencv/issues/19870)
- [Problems building OpenCV for Qt using cmake in Windows](https://forum.opencv.org/t/problems-building-opencv-for-qt-using-cmake-in-windows/2662)
