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. Why Does qDebug() Produce no Output?
Forum Update on Monday, May 27th 2025

Why Does qDebug() Produce no Output?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdebugoutputfailed
1 Posts 1 Posters 1.5k Views
  • 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.
  • ghborrmannG Offline
    ghborrmannG Offline
    ghborrmann
    wrote on last edited by
    #1

    I've recently started to learn QT, by following a tutorial writing my own project and source files (not using QtCreator or Designer). I'd like to use qDebug(), but I haven't been able to get any output from any useful area of my code. I found one similar complaint in your forum: QDebug() does not display anything, but the resolution to that problem does not seem applicable to my situation. My Qt5 system was installed from the Fedora 23 repos. My initial source code was much more complicated, but I've managed to pare down the code to the following which illustrates the problem:

    int main(int argc, char *argv[]) {
    
      qDebug("From qDebug before app");
      printf("From printf before app\n");
      fprintf(stderr,"From fprintf(stderr) before app\n");
      QApplication app(argc, argv); 
      qDebug("From qDebug after app");
      printf("From printf after app\n");
      fprintf(stderr,"From fprintf(stderr) after app\n");
    
      return app.exec();
    }
    

    The output from the above code:

    From qDebug before app
    From printf before app
    From fprintf(stderr) before app
    From printf after app
    From fprintf(stderr) after app
    ^C
    
    

    The basic question is, why does the first qDebug() call generate output while the second one doesn't? Obviously, something is happening in the QApplication constructor which changes qDebug's behavior. Can this be anything but a bug??
    I've tried a great many combinations in my actual code; I never get any output except from a call (if present) before QApplication. I've also tried the qDebug() << "message" syntax: this fails as well. I've tried qInstallMessageHandler(0) with no effect.

    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