The program has unexpectedly finished.

  • Hello Everyone,

    This is a very newbie situation, Im doing some tests with QT and OpenCV, first in windows and then i will go to XUbuntu. I have some algorithms that i've tested in VisualStudio, and i need to port them to an Embedded development Board (PandaBoard), for that i'm doing my first steps on QT and until now i only had huge problems.

    I've installed "Qt Creator 2.8.1 based on QT 5.1.1", and OpenCV 2.4.6 and after i could finally link the libraries, i'm only getting this error after trying to run my program.
    exited with code -1073741819

    This is the code:


    Project created by QtCreator 2013-09-19T22:48:23


    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = QT-ShowImage
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    INCLUDEPATH += C:\opencv246\build\include

    LIBS += -LC:\opencv246\build\x86\mingw\bin

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <opencv/cv.h>
    #include <opencv2/imgproc/imgproc.hpp>
    #include <opencv/highgui.h>
    #include <QFileDialog>

    namespace Ui {
    class MainWindow;

    class MainWindow : public QMainWindow

    explicit MainWindow(QWidget *parent = 0);

    // void changeEvent(QEvent e);
    QString FileOpName; //declare FileOpName as IplImage
    imagerd; //declare imagerd as IplImage

    private slots:
    void on_pushButton_clicked();
    void openImage(); //add a new openImage function to the project

    Ui::MainWindow *ui;

    #endif // MAINWINDOW_H@

    @#include "mainwindow.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    MainWindow w;;

    return a.exec&#40;&#41;;


    @#include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/imgproc/imgproc.hpp>
    //#include <opencv/cv.h>
    //#include <opencv/highgui.h>
    #include <QPixmap>
    #include <QString>
    #include <QFileDialog>
    #include <QMessageBox>

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;

    void MainWindow::openImage()
    //declare FileOpName as the choosen opened file name
    FileOpName = QFileDialog::getOpenFileName(this,
    tr("Open File"),
    tr("Image Files(*.png *.jpg *.jpeg *.bmp)"));

    //Check if FileOpenName exist or not
    //Check if FileOpName exist or not
    if (!FileOpName.isEmpty())
        QImage image(FileOpName);
        if (image.isNull()) {
            QMessageBox::information(this, tr("Face Recognition"),
                                     tr("Cannot load %1.").arg(FileOpName));
    //function to load the image whenever fName is not empty
    if( FileOpName.size() )
      //imagerd = cvLoadImage(FileOpName.;
      imagerd = cvLoadImage("c:\\image.jpg");//the other way to read path with the QFileDialog wasn't compiling, so for now, just an image from the hard disk
      QImage imageView = QImage((const unsigned char*)(imagerd->imageData), imagerd->width,imagerd->height,QImage::Format_RGB888).rgbSwapped();


    void MainWindow::on_pushButton_clicked()

  • Moderators

    Its an "Access violation": exception on windows.

  • quote author="p3c0" date="1379700576"]Its an "Access violation": exception on windows.[/quote]

    I'm using an example i found on a Tutorial, and it seems to work normally for the author.

    The fact is that it doesnt even show the main window, but when i compile commenting this line
    @imagerd = cvLoadImage("c:\image.jpg");@
    (which, i was careful enough to copy there)

    It runs normallly, but off course it doesnt do anything important.

    i guess there's still some problems in the libraries and in the linker, but until now i've followed all the guides, and i can't even get to show a single imagen using OPENCV

  • Moderators

    Can you put a check and see it "imagerd" is not NULL after doing cvLoadImage() ?

  • Moderators

    Maybe this one helps you "Qt program exited with code -1073741819":
    They are also using Qt and OpenCV libraries

  • This are my first step on QT, after several years in other IDE's. I
    it seems that i'm not even able to do a debug at this time.

    I build the app, i put several breakpoints, and when i push Debug, i only get an error stating:
    "The inferior stopped because it received a signal from the Operating System
    Signal Name: SISSEGT
    Signal meaning: Segmentation"

    I google it a 'lil bit, but i can't find the right way to deal with this. Maybe with your expertise i can find it.

    Thanks in advance

Log in to reply

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