Opencv_highgui seems that it can't find all the Qt libs. [closed]

asked 2018-11-10 06:56:08 -0600

Riddle Aaron gravatar image

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. image description 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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-28 13:11:33.072639

Comments

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 ?

  • do you absolutely NEED qt support (for highgui) here ? (opencv will build fine without, all you get is some "extra" stuff )
  • do you plan to use qt gui functions in your own program later ? (that would be XOR, you can only have one or the other !)
berak gravatar imageberak ( 2018-11-10 07:08:23 -0600 )edit
1

@berak I'm using MinGW 7.2.0 for both. I'll try building it without Qt then.

Riddle Aaron gravatar imageRiddle Aaron ( 2018-11-11 07:02:44 -0600 )edit

ah, ok . 64bit , i assume ? (might be a misfit between the 32bit qt libs and your 64bit compiler)

also some cmake options:

WITH_IPP=OFF
WITH_MSMF=OFF
ENABLE_PRECOMPILED_HEADERS=OFF
berak gravatar imageberak ( 2018-11-11 07:06:39 -0600 )edit

@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.

Riddle Aaron gravatar imageRiddle Aaron ( 2018-11-11 09:39:04 -0600 )edit

i'm using 7.2.0 too, and i never had the problem.

how do you get that "pei" information ?

When I compile the program, all the dll files make an error

what are you doing there, exactly ? can you show your cmdline or similar ?

berak gravatar imageberak ( 2018-11-11 09:49:42 -0600 )edit
1

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

Riddle Aaron gravatar imageRiddle Aaron ( 2018-11-11 09:59:37 -0600 )edit

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:

g++ myprog.cpp -I/my/opencv/build/install/include -L/my/opencv/build/install/x64/mingw/lib -lopencv_core400 -o myprog

if that does not work, -- again, what about a "clean slate" ? (clean the build folder, start all over with cmake)

berak gravatar imageberak ( 2018-11-11 10:10:26 -0600 )edit
1

@berak Hmmm... very strange. There's no error if I try the one you mentioned.

Riddle Aaron gravatar imageRiddle Aaron ( 2018-11-11 10:34:24 -0600 )edit

so, blame it on qtcreator picking up wrong / outdated things.

(but this gets somewhat off-topic here, we cannot help you with it)

berak gravatar imageberak ( 2018-11-11 10:39:39 -0600 )edit

@berak Yes. I suspect that this is related to 32bit - 64bit problem of Qt. Thanks for answering!

Riddle Aaron gravatar imageRiddle Aaron ( 2018-11-11 11:09:01 -0600 )edit