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. Qt qDebug not working with QConsoleApplication or QApplication
QtWS25 Last Chance

Qt qDebug not working with QConsoleApplication or QApplication

Scheduled Pinned Locked Moved Solved General and Desktop
qdebugqcoreapplicatioqapplication
5 Posts 3 Posters 12.8k 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.
  • M Offline
    M Offline
    Marius_Linux
    wrote on last edited by A Former User
    #1

    I currently have a terribly annoying problem while developing programs using Qt and Qt Creator. Whenever I try using qDebug() with a QCoreApplication or QApplication instantiated before using qDebug(), there isn't any output, whether I run the program in Qt Creator or from a normal shell(I'm using Fedora Linux btw). For example, even the following simple code fails:

    int main(int argc, char *argv[])  {
        QCoreApplication a(argc, argv);
        qDebug() << "TestOutput!" << endl;
    }
    

    Does anybody know what to do about this problem? Thanks in advance, Marius

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

      Hi and welcome to devnet,

      Can you build your code sample ? You're not returning anything from main.

      On OS X, no problem

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • A Offline
        A Offline
        alex_malyu
        wrote on last edited by
        #3

        Just obvious - check if you do not have QT_NO_DEBUG_OUTPUT defined.
        Another possibility on Windows I've seen such effects when wrong dll (from other Qt version ) were picked up.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Can you build your code sample ? You're not returning anything from main.

          On OS X, no problem

          M Offline
          M Offline
          Marius_Linux
          wrote on last edited by Marius_Linux
          #4

          @SGaist said:

          Hi and welcome to devnet,

          Can you build your code sample ? You're not returning anything from main.

          On OS X, no problem

          @alex_malyu said:

          Just obvious - check if you do not have QT_NO_DEBUG_OUTPUT defined.
          Another possibility on Windows I've seen such effects when wrong dll (from other Qt version ) were picked up.

          Yes it runs, and when I build it using Qt4 on the same system, I can see the desired output. I've tested the exactly same code in a freshly installed Fedora 22 system, it's compiling and running without problems, so I figured it has something to do with my system's configuration, but I don't know what it could be, I've already tried reinstalling the Qt packages using dnf/yum, but still no luck. I've also removed all packages I've installed in the last couple days, and did downgrades, because saturday everything was OK and working...

          EDIT: When using qWarning() instead of qDebug(), I get the output. But still, I want to find out, whats the origin of this strange problem. Otherwise, I have to reinstall my whole OS, which would be pretty annoying...

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Marius_Linux
            wrote on last edited by
            #5

            OK guys, I was able to solve the problem. The Fedora people changed a configuration file, so that qDebug output wasn't shown to the user anymore, until the user changed the settings like described here:
            https://bugzilla.redhat.com/show_bug.cgi?id=1227295

            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