I've been learning qt on windows for a little while (background in unix/embedded) and would like to have stderr/stdout dumped out somewhere (unit test/event logging/debug) from my win32 qt GUI app. That seems to be a tall order in windows and I found this post on stackoverflow which explains why.
I find myself wondering why qt doesn't have a simple mechanism for performing some of the suggestions in the post for debug builds.
Does such a facility already exist in qt or am I left to roll my own (or find a syslog lib)?
Output is available on the taskbar in all modes. You can view output in the following ways: Select the output view on the taskbar. Select Alt (Cmd on macOS) and the number of the view on the taskbar.
qDebug() and related functions are handy for that sort of thing - will get sent to the debugger (if you're using Qt Creator, that will pick those up easily!)
#include <QDebug>
qDebug() << "x is: " << x;
You can always start your programs from the command line to see stdout output (cmd.exe). Also, like Paul Dixon said, by using qDebug() you should be able to see the output in the debugger.
#include <QDebug>
...
{
...
int x = 5;
qDebug() << "x is: " << x;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With