Qt5 + opencv invalid pointer [closed]

asked 2015-12-14 09:44:06 -0600

lyw8120 gravatar image

updated 2016-01-17 10:39:14 -0600

Dear all, I spent the whole day to solve a weird problem. Qt5 and opencv can work independently.

when I put opencv code into the qtcreater, bugs come.

* Error in `/home/think/QtProject/build-opencv-test2-Desktop-Debug/opencv-test2': realloc(): invalid pointer: 0x00000032c5eed840 *

======= Backtrace: =========

/usr/lib64/libc.so.6[0x36b0077d9e] /usr/lib64/libc.so.6(realloc+0x290)[0x36b00845d0] /usr/lib64/libQt5Core.so.5(_ZN9QListData7reallocEi+0x1f)[0x3d24f0a3ef] /usr/lib64/libQt5Core.so.5(_ZN9QListData6appendEi+0x6e)[0x3d24f0a4ae] /usr/lib64/libQt5Core.so.5[0x3d24fdb474] /usr/lib64/libQt5Core.so.5(_Z21qRegisterResourceDataiPKhS0_S0_+0x326)[0x3d24fd7596] /usr/lib64/libQt5Core.so.5[0x3d24e7a333] /lib64/ld-linux-x86-64.so.2[0x36afc0ff2a] /lib64/ld-linux-x86-64.so.2[0x36afc1003b] /lib64/ld-linux-x86-64.so.2[0x36afc00d2a]

======= Memory map: ========

00400000-00405000 r-xp 00000000 fd:02 14286978 /home/think/QtProject/build-opencv-test2-Desktop-Debug/opencv-test2 00604000-00605000 r--p 00004000 fd:02 14286978 /home/think/QtProject/build-opencv-test2-Desktop-Debug/opencv-test2 00605000-00606000 rw-p 00005000 fd:02 14286978 /home/think/QtProject/build-opencv-test2-Desktop-Debug/opencv-test2 01610000-01652000 rw-p 00000000 00:00 0 [heap]

I thought it was the problem of finding the correct position of opencv libs, and tried to use differrent way,all of them did not work.

LIBS += pkg-config opencv --libs

LIBS += -L /usr/local/lib/libopencv_core.so \

    /usr/local/lib/libopencv_imgproc.so \

    /usr/local/lib/libopencv_highgui.so

LIBS += -L/usr/local/lib

LIBS += -lopencv_core

LIBS += -lopencv_imgproc

LIBS += -lopencv_highgui

it was caused by the Qt, conflict by different Qt version.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by lyw8120
close date 2016-01-17 10:38:22.537410