[solved (project dependencies)] Debugger misbehaves

  • Using QtCreator 3.01 with Qt 5.2.1 while debugging I experience some strange debugger behavior

    1. I can't step into some of my functions. Debugger steps over the function instead. (caller and callee are in the same library)
    2. Debugger does not stop at some (but not all) breakpoints

    The only cure seems to be a complete clean all, followed by build all. But then after changing the source problems repeat all over forcing me to do time consuming rebuild all over again.

    I admit being inexperienced with QtCreator. Am I doing something wrong?
    (I am sure that I am building Debug not Release)

  • An odd thing that I noticed is that the clean command does not delete static library (my project consists of static library and application that uses it). Shouldn't make kill and totally rebuild *.a when one of the sources changed? I am guessing that is not happening but should and therefore resulting application uses previous version of the code and causes debugger misbehaving.

    Plausible? Is it a bug somewhere or did I inadvertently mess up *.pro which in turn messed up makefile?

  • Getting project dependencies not right is a plausible explanation.

    Does you stepping work after a clean build?

  • You must be right and the problem must relate to qmake / makefile. My application consists of a static library (sub-project) and gui application. When I make changes to library sources and rebuild application behaves like it still uses old version of sources. If I delete both *.a of a library and *.app then after rebuild I see effects of code changes. Unfortunately my experience is mostly with Visual Studio, so I would appreciate help in understanding and fixing *.pro files.

    Here is the outline of what I have



    TEMPLATE = subdirs

    CONFIG += ordered

    SUBDIRS +=


    QT -= core gui

    TARGET = myCore
    TEMPLATE = lib
    CONFIG += staticlib
    CONFIG += c++11
    INCLUDEPATH += /opt/local/include

    SOURCES +=

    HEADERS +=
    unix {
    target.path = /usr/lib
    INSTALLS += target


    QT += core gui opengl

    greaterThan(QT_MAJOR_VERSION, 5): QT += widgets

    TARGET = myProject
    TEMPLATE = app
    CONFIG += c++11
    INCLUDEPATH += /opt/local/include
    INCLUDEPATH += ../myCore
    LIBS += -L../myCore -lmyCore

    SOURCES += main.cpp

    HEADERS +=

    FORMS += mainwindow.ui

    Can someone spot a problem?

  • I am now fairly convinced that my problems happen because the app does not relink when static library is updated. Do I have to specify explicitly a dependency on static library, how?

  • Daah! There is a button in QtCreator context menu to add a library to application. Let's see it it solves the problem.

  • Check out http://qt-project.org/doc/qt-5/qmake-variable-reference.html#pre-targetdeps

    And I wouldn't mind if you could change the topic of the thread here.

  • Solved. Qmake is not smart enough to add library dependency by itself, user action is required.
    @apoenitz - thanks for the link

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.