Opencv_highgui seems that it can't find all the Qt libs. [closed]
While the opencv_highgui was being built during building of the OpenCV (the lastest version in the github), the following undefined errors occurred.
[ 40%] Linking CXX shared library ..\..\bin\libopencv_highgui400.dll
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN10CvWinModelD1Ev[_ZN10CvWinModelD1Ev]+0x17): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN10CvWinModelD0Ev[_ZN10CvWinModelD0Ev]+0x1e): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$__tcf_2+0xa): undefined reference to `__imp__ZN6QMutexD1Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$__tcf_1+0xa): undefined reference to `__imp__ZN14QWaitConditionD1Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZL16icvFindBarByNameP10QBoxLayout7QString7typeBar.constprop.204+0x37): undefined reference to `__imp__ZeqRK7QStringS1_'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZThn16_N10CvWinModelD1Ev[_ZThn16_N10CvWinModelD1Ev]+0x1c): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZThn16_N10CvWinModelD0Ev[_ZThn16_N10CvWinModelD0Ev]+0x22): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x11): undefined reference to `__imp__ZNK20QFutureInterfaceBase10isCanceledEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x42): undefined reference to `__imp__ZNK20QFutureInterfaceBase5mutexEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x60): undefined reference to `__imp__ZN6QMutex4lockEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x6f): undefined reference to `__imp__ZNK20QFutureInterfaceBase10queryStateENS_5StateE'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x83): undefined reference to `__imp__ZN20QFutureInterfaceBase14reportFinishedEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0xa8): undefined reference to `__imp__ZN20QFutureInterfaceBase15resultStoreBaseEv'
... (it is very long)
It seems that all the Qt libs were not linked. But I checked that I specified all the paths correctly. I also asked this problem to Qt forum, but it seems that this problem doesn't have something to do with Qt. At least, I hope that I can get any clue to solve this problem.
which mingw compiler are you using ?
(the qt libs seem to be 5.1, 32bit)
instead of the (useless, can't be quoted from or indexed for search) screenshot, could you add the cmake output (AS TEXT !) to your question ?
@berak I'm using MinGW 7.2.0 for both. I'll try building it without Qt then.
ah, ok . 64bit , i assume ? (might be a misfit between the 32bit qt libs and your 64bit compiler)
also some cmake options:
@berak It is built successfully if I uncheck "with qt" option. But I face another problem. When I compile the program, all the dll files make an error : "file not recognized: File format not recognized" I search this, and I found that the file format between the one which I used before and the current one is different. (Using objdump -a) A format of the one I used is "pei-i386" and the current one is "pei-x86-64". Why does this happen? The version of OpenCV is 4.0.0, which is the latest.
i'm using 7.2.0 too, and i never had the problem.
how do you get that "pei" information ?
what are you doing there, exactly ? can you show your cmdline or similar ?
I got the "pei" information using "objdump -a" command. And the error occurs when I compile the program on Qt Creator. And I just noticed that my MinGW version is not 7.2.0 but 8.1.0
i wonder, how you got over this, then ;)
try to get qtcreator out of the way, for a second. make a simple prog, that uses just 1 cv::Mat, and try to use:
if that does not work, -- again, what about a "clean slate" ? (clean the build folder, start all over with cmake)
@berak Hmmm... very strange. There's no error if I try the one you mentioned.
so, blame it on qtcreator picking up wrong / outdated things.
(but this gets somewhat off-topic here, we cannot help you with it)
@berak Yes. I suspect that this is related to 32bit - 64bit problem of Qt. Thanks for answering!