Results 1 to 3 of 3

Thread: How to debug in QtCreator on Ubuntu Linux

  1. #1
    Join Date
    Jun 2017
    Posts
    7
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default How to debug in QtCreator on Ubuntu Linux

    On Windows debugging in QtCreator is quite simple. But I've not managed to do the same on Ubuntu Linux. I got the message that no debug version is built. What should I do in order to be able to debug?
    (The same question is in the forum general discussion as a reply to my own question how to install gdb on Ubuntu, since this seems to be more suitable there. Now I think the debug question is a topic for this forum. Excuse me for double posting.)

  2. #2
    Join Date
    Jun 2017
    Posts
    7
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to debug in QtCreator on Ubuntu Linux

    Now I've written the following program on Linux for debugging:
    #include <QtCore/QCoreApplication>
    #include <iostream>
    using namespace std;
    int main(int argc, char *argv[])
    {
    QCoreApplication app(argc, argv);
    double a, b, c;
    a = 1.3f;
    b = 2.6f;
    c = a / b;
    cout << "a / b = " << c << endl;
    return app.exec();
    }
    I've set a breakpoint at the line "a = 1.3f;". But if I started debugging, the program seems to execute over it and I got the result window showing "a / b = 0.5". The editor window is now separated into several little windows which show the debug state. But I can not really debug. What's the correct step to debug on Linux? On Windows this should work well.

  3. #3
    Join Date
    Apr 2017
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How to debug in QtCreator on Ubuntu Linux

    You can try or check the following points:
    (I assume that you are using qmake.)

    1. In the project settings under 'Build Settings' you can select 'Debug' as build configuration.
    2. Add the following line in the qmake .pro file: QMAKE_CXXFLAGS += -O0 -ggdb -fno-omit-frame-pointer -fno-limit-debug-info
    This might not be the right qmake variable because this one is independent from the Build Settings.
    Not sure the two -f... flags are needed.

Similar Threads

  1. Replies: 2
    Last Post: 18th November 2015, 14:57
  2. Qt + Linux + Eclipse - debug using debug build?
    By will49 in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2012, 07:27
  3. Using QtCreator on Ubuntu
    By feraudyh in forum Newbie
    Replies: 2
    Last Post: 2nd March 2011, 18:07
  4. Replies: 10
    Last Post: 13th November 2009, 20:31
  5. qt debug on ubuntu
    By yaron in forum Installation and Deployment
    Replies: 4
    Last Post: 3rd March 2008, 23:17

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.