QDebug() doesn't always appear in "Application Output"
-
Hello, I've seen a bunch of threads on this problem around the web, but none seemed to have fixed my issue. I am using Qt Creator under windows. When I use qDebug() in my main function it works flawlessly
@int main(int argc, char *argv[])
{
qDebug() << "Hello World - appear in Application Output please\n";
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}@but then in my main window things get weird:
@MainWindow::~MainWindow()
{qDebug() << "Hello World - appear in Application Output please\n"; setWindowTitle(tr("My GUI"));
}@
This qDebug() statement does not appear in the App. Output console while the application is running. Occasionally it pops up upon application termination. I'm trying to use qDebug() like I'm used to using System.out.println(s) in Java. Any thoughts? Do I need to invoke a separate thread to print? Thanks.
-
Hi,
Just one question: Why set the window title in the destructor ?
Did you declare your destructor as virtual ?
-
Maybe you have different defines.
bq. Both qDebug() and qWarning() are debugging tools. They can be compiled away by defining QT_NO_DEBUG_OUTPUT and QT_NO_WARNING_OUTPUT during compilation.