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?
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
2010-10-07 22:19:25
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
2010-10-07 23:23:22
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
2010-10-14 00:54:45
+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.
2010-10-08 00:32:31