Unsolved Application Output not displaying cout statements
-
I'm about as new to Qt as you can get and I have a question in regards to displaying simple output. I normally use Xcode on my macbook for c++ development but since I'm about to start using Qt at work I thought it would be best to familiarize myself to Qt.
Therefore, my question is how do I setup my Application Output window in Qt to display output for helping me debug my c++ source code. For example when I click build and then click run it displays my output in the "terminal" window. This is fine but its messy and I have to close out of my terminal session every time I run my program. Any help is appreciated.
I'm sure we all know what a helloworld.cpp file looks like but for completeness here is my code below.
#include <iostream> using namespace std; int main() { cout << "Hello World\n"; return 0; }
-
So it appears when I'm in "Debug" mode I can see the output just fine in the "Application Output". However, when i'm in "Run" mode it doesn't output my cout statement in the "Application Output" but will in "Terminal". Which I guess is ok but would rather have more control over this feature.
If i'm forced to use Terminal I would much rather use iTerm 2. Does someone have some advice here on how to control these features. I see I can add a path to the executable for iTerm2 in Preferences>Environment which I did as shown here.
However, when I run my program it will display iterm 2 for like 1 second along with a weird error and vanishes.
-
If you want to have some debug output then use qDebug() << "message";
#include <QDebug> int main() { qDebug() << "Hello World"; return 0; }
-
Hi,
Something like this:
cout << "Hello World" << endl;
std::endl flushes the output buffer but newline('\n').