highgui lib cannot link to qt5widgets (opencv3.2 qt5.7 static linking)

asked 2019-04-25 01:27:17 -0600

Ejok gravatar image

updated 2019-04-25 03:16:42 -0600

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(mingw 5.3 32bit) 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_highgui320lib in PRE_TARGETDEPS, but without any results..

edit retag flag offensive close merge delete

Comments

why outdated 3.2 ? do you want to build a qt program ?

berak gravatar imageberak ( 2019-04-25 06:05:16 -0600 )edit

Yes, I want to build a qt program (I already built this program in dynamic build mode). Unfortunately, I was not able to create the latest versions of OpenCV (3.4, 4.x) and I don't need any more functionality.

Ejok gravatar imageEjok ( 2019-04-25 08:27:57 -0600 )edit