PDA

View Full Version : How to debug C-only program using GTK from QT Creator?



resander
4th April 2013, 13:12
I would like to try QT Creator and recompile and rebuild some C-only projects each with 10+ source files using raw GTK (no GUI builder used) for 64-bit Ubuntu 12.04 LTS. These projects work fine on desktops and I am now thinking about accessing them from Android mobile phones. The first step would be to rebuild the projects using QT Creator just to see how it goes while still on the desktop.

I made a one-line int main( int argc, char * arv[]) { printf("Hello\n"); } just to try debugging but I could not make it work, probably because there is some prepare step I am not aware of. Here is what I did:

- used the wizard to create a new project: Other projects->Plain C
- this resulted in a project directory hello with a single source file main.c
- did rebuild all
- placed the cursor in the left hand margin next to the line with printf.
(a round break point mark appeared)
- selected Start debugging from the menu

I expected the program to stop at the breakpoint, but it did not. A console window appeared instead.
The move-to-next-line, move-into etc did not work.
The wizard said that both a Debug and Release version would be created. I removed the Release project directory leaving Debug version and repeated, but that did not make any difference.

I also tried the adressbook demo and debugging worked fine for that.

What am doing wrong?

Ken

sonulohani
5th April 2013, 11:06
Use GNU GCC default debugger instead of qt debugger.

ChrisW67
6th April 2013, 00:34
Works fine out-of-the box here. Make sure you have built a debug version of the program.

@sonulohani: On Linux boxen the "qt debugger" is the GNU Project Debugger (http://www.gnu.org/software/gdb/) which I assume is what you mean by the "GNU GCC default debugger". GDB is not part of the GNU Compiler Collection though.