qtqt-creatorqdebug

QtCreator: qDebug Messages Not Shown


I am currently using QT Creator 3.2.1 with Qt 5.3.2 (as required by my current project) on Windows 7 (64 bits, Ultimate). I am currently working on a GUI project

I am unable to see any qDebug messages in the Application Output window despite already done the following:

  1. Having the appropriate QDebug code
  2. Building the project in Debug mode
  3. Using "CONFIG += openssl-linked" "CONFIG += console" as additional arguments for building the project
  4. Not defining QT_NO_DEBUG_OUTPUT at all
  5. Confirming that I have a debugger (GDB from MinGW 4.8.2 32 bit installed during installing QtCreator)

May I know what else should I try? Thanks!


Solution

  • I don't get any debug messages supposed to be printed out by qDebug() in Qt Creator? What could be the reason for that?

    It is common to redefine the standard Qt debug output in Qt apps via the custom log message handler but we can still take care of making debug messages to reach the debug console:

    // example for custom message handler
    void customLogHandler(QtMsgType type, const QMessageLogContext& context,
                          const QString& msg)
    {
       // send the data to log file via the other thread
       emit writeToFile(type, context, msg);
    
       // now output to debugger console
    #ifdef Q_OS_WIN
        OutputDebugString(text.toStdWString().c_str());
    #else
        std::cerr << text.toStdString() << std::endl;
    #endif
    }
    
    void main()
    {
       // custom handler start
       qInstallMessageHandler(&customLogHandler);
    
       // other app initializations
    }