Compile opencv with QT5 error

[ 40%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.obj
[ 40%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.obj
[ 40%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/qrc_window_QT.cpp.obj
[ 40%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/opencv_highgui_automoc.cpp.obj
[ 40%] Linking CXX shared library ..\..\bin\libopencv_highgui300.dll
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN11GuiReceiverD2Ev+0x27): undefined reference
to `_imp___ZN7QObjectD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN11GuiReceiverD2Ev+0x3a): undefined reference
to `_imp___ZN7QObjectD2Ev'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj): bad reloc address 0x3a in section `.text$_ZN11GuiReceiverD2Ev'
collect2.exe: error: ld returned 1 exit status
modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:203: recipe for target 'bin/libopencv_highgui300.dll' failed
mingw32-make[2]: *** [bin/libopencv_highgui300.dll] Error 1
CMakeFiles\Makefile2:4908: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
mingw32-make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

I would not recommend using v3.0.0 because it’s from 2015. v4.5.2 is the latest release, and if you really need to, there’s v3.4.14.

related:

thank u. and I 'll download V4.5.2