Important: Please read the Qt Code of Conduct -

No console window in GUI app with CONFIG+=console

  • My GUI app won't start with a console even if I add the line "CONFIG+=console" in the projetc file.

    I tried to clean all files before recompile it but still no console.

    Qt lib 4.8
    Qt Creator 2.4
    Compiler mingw32

    Does somebody have an idea ?

  • have you tried deleting the makefiles and/or re-running qmake?

  • Yes, i tried to delete all generated files ( including makefiles ) and rebuild the project in a Qt command prompt

  • Are you using "QApplication": or "QCoreApplication": instance?

    @The QApplication class manages the GUI application's control flow and main settings.@

    @The QCoreApplication class provides an event loop for console Qt applications.@

  • Should not matter, you can get a console with a QApplication too. Also note that QApplication inherits QCoreApplication.

  • I'm using a QApplication instance. But i'm not sure if the problem is here 'cause this feature was made to provide a debug console in GUI app.

  • Hello
    AFAIK Qt Creator automatically gets debug output from the application and shows it at "Application Output" tab.

  • A QApplication always initializes the graphics system. For a real console app, without using QtGui module, you need QCoreApplication.

    There is no easy way to provide a "debug console" in your application. You will need to attach to the windows service for that or provide a logger window for qDebug/qWarning/qError yourself. For the latter, there is an example for a "Browser for QDebug Log Output":/wiki/Browser_for_QDebug_output in the wiki.

    PS: There's another, more sophisticated logger framework. See the "announcement in the showcase forum":/forums/viewthread/2654.

Log in to reply