How to redirect QT’s “Application Output” to a console window outside QT Creator

Hi,

I was having a problem with my application where a signal was not being connected to a slot, but I was not able to see why because the part of the application where it was happening was dependent on an external device, which was only connected to another computer without QT Creator installed.

After some search, I found that remote debugging would be a good option, but information about how to setup it in windows machines was hard to find, and the lack of experience in similar questions made me quit the idea.
Then I found a simple way to redirect the application output (where all warning and error messages of the QT are printed) to a new console window that is opened together with the application, here are the steps:

Add “CONFIG += console” to your QT project file (name_of_the_project.pro), like this:

Then save the file and do the following:

  • Clean Project (in Build menu)
  • Run qmake (in Build menu)
  • Rebuild Project (in Build menu)
After this, your executable will open along with a console window where all debug messages will be printed, BUT when running from QT Creator you will still get the debug messages from the “application output”, to avoid it and get the console window even when running from inside QT Creator, go to “Projects” in the left side of the screen, select “Run” in the “Build & Run”, and mark the “Run in Terminal” checkbox.