0

I have a strange problem, I had developed 2 months ago a small project and I started to work on it again.

The problem is that the application starts (as I can click on the stop button in the IDE to kill it). But the windows does not show. No error messages are shown, I tried to launch it outside of the IDE (with all DLLs and platform plugins). But this is the same.

Here is my MainWindow constructor :

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow) {
    qDebug() << "R";
    ui->setupUi(this);
    ui->statusbar->setSizeGripEnabled(false);
    recorder = new QAudioRecorder(this);
    createTempDir();
    this->canProcessData = false;

    this->state = WAITING;
    this->mode = NONE;

    connect(this->recorder, SIGNAL(durationChanged(qint64)),
            this, SLOT(updateDuration(qint64)));
    connect(this->recorder, SIGNAL(statusChanged(QMediaRecorder::Status)),
            this, SLOT(updateStatus(QMediaRecorder::Status)));
    connect(this->recorder, SIGNAL(stateChanged(QMediaRecorder::State)),
            this, SLOT(onStateChanged(QMediaRecorder::State)));
    connect(this->recorder, SIGNAL(error(QMediaRecorder::Error)),
            this, SLOT(showError()));

    // list settings
    foreach(const QString &device, recorder->audioInputs()) {
        ui->input_device->addItem(device, QVariant(device));
    }
    foreach(const QString &codec, recorder->supportedAudioCodecs()) {
        ui->codec->addItem(codec, QVariant(codec));
    }
    foreach(int sample_rate, recorder->supportedAudioSampleRates()) {
        ui->sample_rate->addItem(QString::number(sample_rate), QVariant(sample_rate));
    }

    this->log("Ready :)");
}

Here is main.cpp code:

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

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

    qDebug() << "A"; 

    MainWindow w; 
    w.setFixedSize(720,455); 
    w.setWindowFlags(w.windowFlags() |= Qt::MSWindowsFixedSizeDialogHint); 
    w.show(); 

    return a.exec(); 

}

As i you can see, I have a qDebug() << "R"; at the first line but it does not even show.

I googled it but obviously all that I could find was topics where it was a DLL problem.

I think its worth mentionning that when I dropped the project 2 months ago I was on the same PC and all the paths (compiler, libraries and Qt) are the same.

I you know something I would be grateful to you.

ahmed
  • 5,430
  • 1
  • 20
  • 36
Peyphour
  • 43
  • 1
  • 5
  • 1
    You showed constructor of MainWindow. Could you please show main() itself? Can you put breakpoint to main() or add qDebug() to it? – demonplus Sep 26 '15 at 19:23
  • @demonplus `#include "mainwindow.h" #include int main(int argc, char *argv[]) { QApplication a(argc, argv); qDebug() << "A"; MainWindow w; w.setFixedSize(720,455); w.setWindowFlags(w.windowFlags() |= Qt::MSWindowsFixedSizeDialogHint); w.show(); return a.exec(); } ` . This is the same, qDebug does not show. – Peyphour Sep 26 '15 at 19:25
  • Have you actually stepped through all of this code in a debugger? – MrEricSir Sep 26 '15 at 20:09
  • @MrEricSir Actually even my first line of code isn't executed (`QApplication a(argc, argv);`). I put a breakpoint and it did nothing in the debugger – Peyphour Sep 26 '15 at 20:13
  • 1
    Okay, I found the error. I use KissFFT and in their code they define a second main method. Now it works – Peyphour Sep 26 '15 at 20:16
  • 1
    Please post your solution (second main method) as an answer in order other people can find it in future – demonplus Sep 27 '15 at 06:14

1 Answers1

0

Maybe you use a library that define an other main entry point, and yours doesn't get called.

ahmed
  • 5,430
  • 1
  • 20
  • 36