Thanks alot,it got solved by including <QtGui>
I was tring with <qDebug>
Thanks alot,it got solved by including <QtGui>
I was tring with <qDebug>
It will work with <QDebug> not <qDebug>
anyway , if u include <QtGui> there is no need to include <QDebug>
Bala
View QT Objects While Debugging
See your QStrings without drilling down!
(quick view in bold)
The kde-devel-gdb package has a bunch of gdb command definitions to help with viewing QString as well as other structures in gdb. You can also use this from within Eclipse via the gdb terminal.
First of all, you need to get the commands loaded into gdb.
get the gdb commands file ( I'll paste the current version on the end here) from kde-devel-gdb.
modify your ~/.gdbinit file to reference it by adding this line at the end:
source ~/kde-devel-gdb
now run gdb in a terminal and type:
apropos q4
and you should see a number of the new commands appear ( such as printq4string )
use the 'q' command to quit
Now run Eclipse
Within Eclipse, go to the Run->DebugConfigurations... Debugger tab and set the GDB command file to your .gdbinit . It may look right... browse to and choose it again anyways.
start debugging something and get to a breakpoint preferably near a QString.
Note that if you select the gdb process in the debug window that the console will switch to gdb.
That changes the context however and you can't get to your variables.
instead, select a thread in the debug window that gets you back to your variable list and then on the upper right of the console window select the little computer monitor drop down and choose gdb.
try apropos q4 again in this gdb console... verify that the printq4string command is there. If not then see the line above just after 'Run Eclipse'. You can also manually run 'source ~/kde-devel-gdb'
now, in the gdb console try to get a QString to print..
printq4string your_QString_here
success!
problems still?:
my gdbinit's 3rd line wasn't liked by gdb and I had to comment it out. watch for complaints when you run gdb from a terminal.
note.. it's printq4string NOT printqt4string.. no 'T'! I'm changing mine to pq or something short instead anyways.
If you figure out a way to automate this further in the eclipse debugger ( use a gdb command in a watch?? debug view casting? ) please tell the rest of us!
(I'm at least changing to a shortened command name.. )
Attachment 5950
I'll attach the kde-devel-gdb file from: http://websvn.kde.org/trunk/KDE/kdes.../kde-devel-gdb . Fewb 14, 2011 version.
Bookmarks