PDA

View Full Version : Program runs even if there is no code



Emit
4th November 2014, 09:50
I have an Aplication(Qt Widgets Aplication). Inside I have 2 .cpp files (main,mainwindow). If i comment out all the includes in mainwindow the program still runs like nothing has happened. I think the program should instead throw an error.
Am I right and the program should not run?

ChrisW67
4th November 2014, 10:39
Do a clean build and see what happens.

Emit
4th November 2014, 13:54
1) cleaned the program
2) Rebuild it
3) than ran it

This is the destructor :


MainWindow::~MainWindow()
{
delete ui;
db.close();
qDebug() << "from destructor1";
// delete model1;
// delete model2;
// qDebug() << "from destructor2";
// qDebug() << ui->textBrowser_MySQL_log->toPlainText();

}


this is the output:


from destructor1
from destructor2

faldzip
4th November 2014, 14:20
So it seems that it is not rebuilt. How did you run it?

Emit
4th November 2014, 15:04
ctrl + r, green buton run

wysota
4th November 2014, 15:27
ctrl + r, green buton run

Try manually deleting the whole build directory of your project and see if the problem persists.

Emit
4th November 2014, 15:40
It looks like now runs as it should.

Emit
4th November 2014, 20:21
Is there a bug in Qt creator or did I do something to make it not work?

ChrisW67
4th November 2014, 20:36
This is not a bug in Qt Creator. The actual compilation has nothing to do with Qt Creator; it merely hands it off to make after running qmake. If you mangle the file timestamps on your source/target files or tell make to build using the wrong files then you get unexpected results. This is quite obvious from the output of the build, which will show little or no actual compilation/linking activity because the target is "up to date". You should read and familiarise yourself with a normal build output.