QtCreator版本:3.4.2
Opencv版本:2.4.11,源代码构建
Qt版:qt5
我的opencv代码可以独立工作,我的纯Qt代码也可以工作。
我的Qtcreator设计的GUI正在运行,但是在加入opencv代码之后会产生一些关于libs的错误。
这是专业档案
QT += core gui
greaterThan(QT_MAJOR_VERSION,4){
CONFIG += c++11
}else {
QMAKE_CXXFLAGS += -std=c++11
}
INCLUDEPATH += /usr/local/include/opencv2
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = BCI
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
错误信息:
*** Error in `xxx': realloc(): invalid pointer: 0x0000000000611600 ***
======= 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-00411000 r-xp 00000000 fd:02 13512007
00610000-00611000 r--p 00010000 fd:02 13512007
00611000-00612000 rw-p 00011000 fd:02 13512007
016db000-0171d000 rw-p 00000000 00:00 0
[heap]
3016600000-30170a0000 r-xp 00000000 fd:01 536855 /usr/lib64/libQtGui.so.4.8.6
30170a0000-30172a0000 ---p 00aa0000 fd:01 536855 /usr/lib64/libQtGui.so.4.8.6
30172a0000-30172e3000 r--p 00aa0000 fd:01 536855 /usr/lib64/libQtGui.so.4.8.6
30172e3000-30172eb000 rw-p 00ae3000 fd:01 536855 /usr/lib64/libQtGui.so.4.8.6
30172eb000-30172ee000 rw-p 00000000 00:00 0
我想我知道导致这个bug的原因是什么,不同版本的qt。 qtcreator中的Qt是qt4,而程序会自动链接qt5。