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. QDebug() doesn't always appear in "Application Output"

QDebug() doesn't always appear in "Application Output"

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.8k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    andy messier
    wrote on last edited by
    #1

    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.

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

      Hi,

      Just one question: Why set the window title in the destructor ?

      Did you declare your destructor as virtual ?

      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
      • B Offline
        B Offline
        belab
        wrote on last edited by
        #3

        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.

        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