我試圖編譯第一開放CV程序與QT5,但是當我嘗試編譯我有這個奇怪的錯誤OpenCV的2.4.5和QT5錯誤:■
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();
}
和我的項目propieties是
#-------------------------------------------------
#
# 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
我不知道是誰造成這個問題,這是我第一次看到它在我的生命 我希望你能幫助我
感謝反正
但是如果我想要WITH__QT怎麼辦? – stfn
@stfn然後安裝較舊版本(Qt 4.0)而不是較新版本(Qt 5.0+)。 –