Results 1 to 3 of 3

Thread: How to debug C-only program using GTK from QT Creator?

  1. #1
    Join Date
    Apr 2013
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to debug C-only program using GTK from QT Creator?

    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

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to debug C-only program using GTK from QT Creator?

    Use GNU GCC default debugger instead of qt debugger.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,688
    Thanks
    13
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to debug C-only program using GTK from QT Creator?

    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 which I assume is what you mean by the "GNU GCC default debugger". GDB is not part of the GNU Compiler Collection though.

Similar Threads

  1. Qt Creator Plain C++ Project won't run/debug...
    By jiapei100 in forum Qt Programming
    Replies: 9
    Last Post: 26th July 2012, 19:09
  2. Qt Creator Can't debug the program with OpenCV in Qt Creator
    By nimingzhe2008 in forum Qt Tools
    Replies: 6
    Last Post: 15th June 2012, 16:04
  3. Program works in Release but not Debug
    By Ferric in forum Newbie
    Replies: 2
    Last Post: 28th January 2010, 02:08
  4. debug -> invisible program
    By sarefo in forum Qwt
    Replies: 3
    Last Post: 16th January 2008, 14:21
  5. QT Program debug,GDB on Linux
    By darpan in forum General Programming
    Replies: 1
    Last Post: 26th January 2007, 23:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.