我正在尝试使用 qt5 编译第一个打开的 cv 程序,但是当我尝试编译时出现这个奇怪的错误
Starting /home/QtContour/build-untitled-Desktop_Qt_5_0_2_GCC_64bit-Debug/untitled...
*** Error in `/home/QtContour/build-untitled-Desktop_Qt_5_0_2_GCC_64bit-Debug/untitled': realloc(): invalid pointer: 0x00007f64e3750340 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7f576)[0x7f64e26b0576]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0x300)[0x7f64e26b4da0]
/home//Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN9QListData7reallocEi+0x26)[0x7f64e31e3e46]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN9QListData7prependEv+0x82)[0x7f64e31e4012]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN10QTextCodecC1Ev+0x85)[0x7f64e339dbe5]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(+0x2728b9)[0x7f64e33a18b9]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(+0x272d0d)[0x7f64e33a1d0d]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN10QTextCodec14codecForLocaleEv+0x32)[0x7f64e339d592]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZNK7QString11toLocal8BitEv+0x19)[0x7f64e3211bd9]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(+0x80702)[0x7f64e31af702]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(+0x7e07c)[0x7f64e31ad07c]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(+0x7e19a)[0x7f64e31ad19a]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZNK14QMessageLogger5fatalEPKcz+0xa9)[0x7f64e31ad8c9]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN9QMetaType22registerNormalizedTypeERK10QByteArrayPFvPvEPFS3_PKvES5_PFS3_S3_S7_Ei6QFlagsINS_8TypeFlagEEPK11QMetaObject+0x48a)[0x7f64e3361bba]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN9QMetaType12registerTypeEPKcPFvPvEPFS2_PKvES4_PFS2_S2_S6_Ei6QFlagsINS_8TypeFlagEEPK11QMetaObject+0x61)[0x7f64e3361c51]
/home/Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5(_ZN9QMetaType12registerTypeEPKcPFvPvEPFS2_PKvE+0x2a)[0x7f64e3361cea]
/usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x1b995e)[0x7f64ddf0e95e]
/lib64/ld-linux-x86-64.so.2(+0xf876)[0x7f64e4679876]
/lib64/ld-linux-x86-64.so.2(+0xf930)[0x7f64e4679930]
/lib64/ld-linux-x86-64.so.2(+0x168a)[0x7f64e466b68a]
======= Memory map: ========
00400000-00405000 r-xp 00000000 08:01 7604445 /home/QtContour/build-untitled-Desktop_Qt_5_0_2_GCC_64bit-Debug/untitled
00604000-00605000 r--p 00004000 08:01 7604445 /home/QtContour/build-untitled-Desktop_Qt_5_0_2_GCC_64bit-Debug/untitled
00605000-00606000 rw-p 00005000 08:01 7604445 /home/QtContour/build-untitled-Desktop_Qt_5_0_2_GCC_64bit-Debug/untitled
01890000-018b1000 rw-p 00000000 00:00 0 [heap]
7f64d40a5000-7f64d40a8000 r-xp 00000000 08:01 42208894 /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f64d40a8000-7f64d42a7000 ---p 00003000 08:01 42208894 /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f64d42a7000-7f64d42a8000 r--p 00002000 08:01 42208894 /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f64d42a8000-7f64d42a9000 rw-p 00003000 08:01 42208894 /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f64d42a9000-7f64d42ad000 r-xp 00000000 08:01 42209011 /lib/x86_64-linux-gnu/libuuid.so.1.3.0 ... ....(much more)
我的 main.cpp 是
#include "mainwindow.h"
#include <QApplication>
#include <opencv/cv.h>
//#include <opencv2/highgui/highgui.hpp>
#include"highgui.h"
using namespace cv;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
Mat frame;
VideoCapture cap(0);
if(cap.isOpened()){
// check if we succeeded
namedWindow("normal",1);
for(;;)
{
cap >> frame; // get a new frame from camera
imshow("nomral",frame);
if(waitKey(30) >= 0) break;
}
}
return a.exec();
}
我的项目属性是
#-------------------------------------------------
#
# Project created by QtCreator 2013-07-02T09:42:06
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = untitled
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += opencv
我不知道是谁造成了这个问题,这是我人生中第一次看到它,希望你能帮助我
不管怎么说,还是要谢谢你