Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Realloc(): invalid pointer QT5.2 + OPENCV2.4.8 + UBUNTU13.10

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

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 6.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Welinton
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      me.javiergmail.com
      wrote on last edited by
      #2

      Hi,

      I'm ecountered the same problem!

      Anybody knows a solution?

      Thnx.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        me.javiergmail.com
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Welinton
          wrote on last edited by
          #4

          [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.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            For 3)

            @
            CONFIG += link_pkgconfig
            PKGCONFIG += opencv
            @

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved