Realloc(): invalid pointer QT5.2 + OPENCV2.4.8 + UBUNTU13.10



  • Hello! I'm new and I'm having trouble compiling a project QT + OpenCV + Ubuntu ...

    I searched several forums and found nothing

    .PRO
    @
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = TesteQT
    TEMPLATE = app

    INCLUDEPATH += /usr/local/include/opencv
    LIBS += -L/usr/local/lib
    LIBS += -lopencv_core
    LIBS += -lopencv_imgproc
    LIBS += -lopencv_highgui
    LIBS += -lopencv_ml
    LIBS += -lopencv_video
    LIBS += -lopencv_features2d
    LIBS += -lopencv_calib3d
    LIBS += -lopencv_objdetect
    LIBS += -lopencv_contrib
    LIBS += -lopencv_legacy
    LIBS += -lopencv_flann
    LIBS += -lopencv_nonfree

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui
    @

    MAINWINDOW
    @#include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QFileDialog>
    #include <opencv/cv.h>
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_btProcurar_clicked()
    {
    cv::namedWindow("Disp");
    cv::VideoCapture cap(0);
    cv::Mat frame;
    do{
    cap >> frame;
    imshow("Disp",frame);
    }while(cv::waitKey(30)<0);
    cv::destroyAllWindows();
    }
    @

    When compiling the project with the error:

    ** Error in `/home/welinton/Documents/Projetos/QtProjetos/build-TesteQT-Desktop_Qt_5_2_1_GCC_64bit-Debug/TesteQT': realloc(): invalid pointer: 0x00007f6305316d80 ***
    ======= Backtrace: =========
    /lib/x86_64-linux-gnu/libc.so.6(+0x7f4c6)[0x7f63043ff4c6]
    /lib/x86_64-linux-gnu/libc.so.6(realloc+0x300)[0x7f6304403cf0]
    /home/welinton/Qt/5.2.1/gcc_64/lib/libQt5Core.so.5(_ZN9QListData7reallocEi+0x26)[0x7f6304d52016]
    /home/welinton/Qt/5.2.1/gcc_64/lib/libQt5Core.so.5(_ZN9QListData6appendEi+0x65)[0x7f6304d520d5]

    ...

    The program has unexpectedly finished.
    /home/welinton/Documents/Projetos/QtProjetos/build-TesteQT-Desktop_Qt_5_2_1_GCC_64bit-Debug/TesteQT crashed



  • Hi,

    I'm ecountered the same problem!

    Anybody knows a solution?

    Thnx.



  • hi again,

    I solve the problem!

    1. complete remove opencv and qt
    2. Install opncv and qt following "this":https://code.google.com/p/qt-opencv-multithreaded/wiki/Documentation instrucions
    3. in your .PRO file put simply
      LIBS += pkg-config --libs opencv

    That's all folks!



  • [quote author="me.javier@gmail.com" date="1403091317"]hi again,

    I solve the problem!

    1. complete remove opencv and qt
    2. Install opncv and qt following "this":https://code.google.com/p/qt-opencv-multithreaded/wiki/Documentation instrucions
    3. in your .PRO file put simply
      LIBS += pkg-config --libs opencv

    That's all folks![/quote]

    Thanks for the reply. I was using netbeans to work with qt and opencv. You helped a lot.


  • Lifetime Qt Champion

    Hi,

    For 3)

    @
    CONFIG += link_pkgconfig
    PKGCONFIG += opencv
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.