One of the first questions I receive when I'm doing courses about QT Creator is

"Hey, how can I printout debbugging info in QT Creator?"

It seems a silly question, but I replied this question 10 times in the last month. So here you are the answer:

There are two ways to do this job:

  1. Standard C++ way

Insert the following include at the beginning of your source file:

#include <iostream>

when you want to print your info just insert the following code

cout << "info = " << infostring <<  endl;

don't forget the endl at the end of your statement, otherwise you won't see anything (due to the buffering). This is the most common error…

 

qtcreator

 

  1. QT Way

Insert the following include at the beginning of your source file:

#include <QDebug>

when you want to print your info just insert the following code

qDebug() << "Here are your results:" << results;

 

 

Nothing more…

Gg1