tags:

views:

98

answers:

3

Im using Qt4 and c++ for making some programs in computer graphics. I need to be able to print some varaibles in my console in runtime, not debugging, but cout doesnt seem to work even if I add the libraries. Is there a way to do this? can some one help me?

+2  A: 
qDebug() << "message";
Goz
I asked ,while not debugging, there must be a function that allows me to write messages in console during runtime, not during debugging.
Zloy Smiertniy
Despite its name, that function is not related to debugging with a debugger. It is a convenience function that Qt provides for sending output to stderr that can be removed from compilation with a define. So it is an alternative for achieving output to the console at runtime.
Arnold Spence
Thank you all a lot, I'm using this :). I guess there is no need then for me to write any of the code I used. Thanks! This has been super usefull.
Zloy Smiertniy
+3  A: 

What variables do you want to print? If you mean QStrings, those need to be converted to c-Strings. Try:

std::cout << myString.toAscii().data();
Sebastian N.
+4  A: 

Add this to your project file:

CONFIG += console
Kyle Lutz