PDA

View Full Version : Is there any way to see printf when using VS2005 and Qt?



ricardo
26th April 2009, 00:17
Hi!

I'm using Qt 4.5, VS2005 and VS integration plugin. Is there any way to see what printf prints just for debug purposes? (or a similar method)

Thanks for help.

vonCZ
26th April 2009, 10:24
I do the following:

1. add this to my .pro file


CONFIG += console

after re-compiling your code, the app should open with a DOS console


2. use qDebug to send output to console



qDebug("show index: %d", myIndexVal);

// or

qDebug() << "show index: " << myIndexVal;



Using the latter option: I think you have to #include <QDebug> (not sure, i rarely use it).

ricardo
26th April 2009, 12:05
Thanks for reply.

I'm using Visual Studio and VS pluging and I don't see any .pro file.
(I'm a beginner)

Any idea?

Thanks.

ricardo
26th April 2009, 12:09
Forget it!

qDebug sends the message to VS Debug Console. SO it is perfect for me. Thanks.

vonCZ
26th April 2009, 12:22
oops: i posted something, then saw you had it. So nevermind :p

ricardo
26th April 2009, 12:50
Anyway, if anyboy knows how to get a DOS console in my case, it would be nice. Just curiosity.

Thanks.