Hello I built OpenCV 3.2 in the static link mode for Qt.
BUILD_SHARED_LIB=OFF
WITH_QT=ON
Then I tried to compile my program in static link mode by Qt 5.7 and get next messages:
linking step:
g++ -static -static-libgcc -Wl,-s -Wl,-subsystem,windows -mthreads -o release\TubeScanner.exe release/main.o release/tsmainwindow.o release/tubescanner_plugin_import.o release/moc_tsmainwindow.o -lmingw32 -LC:\Qt\Qt5.7.0\5.7\Static_debug_release\lib C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libqtmain.a -LC:\OpenCV\opencv_bin_static\install\x86\mingw\staticlib -lopencv_highgui320 -lopencv_imgcodecs320 -lopencv_imgproc320 -lopencv_core320 -lopencv_features2d320 -lopencv_calib3d320 C:\OpenCV\opencv_bin_static\install\x86\mingw\staticlib\libzlib.a C:\OpenCV\opencv_bin_static\install\x86\mingw\staticlib\liblibjpeg.a C:\OpenCV\opencv_bin_static\install\x86\mingw\staticlib\liblibjasper.a C:\OpenCV\opencv_bin_static\install\x86\mingw\staticlib\libIlmImf.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libQt5Widgets.a -LC:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\platforms C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\platforms\libqwindows.a -lwinspool -lshlwapi C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libQt5PlatformSupport.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libQt5DBus.a -lnetapi32 C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libqtfreetype.a -LC:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqdds.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqicns.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqico.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqtga.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqtiff.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqwbmp.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\plugins\imageformats\libqwebp.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lwinmm -lglu32 -lopengl32 -lgdi32 C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libqtharfbuzzng.a C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libqtpcre.a
errors after linking: C:\OpenCV\opencv_bin_static\install\x86\mingw\staticlib\libopencv_highgui320.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN10CvWinModelD1Ev[__ZN10CvWinModelD1Ev]+0xf): undefined reference to
_imp___ZN7QWidgetD2Ev`
But -lopencv_highgui320
is situated before C:\Qt\Qt5.7.0\5.7\Static_debug_release\lib\libQt5Widgets.a
...
I tried to prepend -lopencv_highgui320
lib in PRE_TARGETDEPS, but without any results..