Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

"Qt No rule to make target" i cannot find the error



  • When compiling my project I am getting the error:
    :-1: error: No rule to make target libgui.a', needed bylibdataaccess.a'. Stop.

    I analyzed the files pro, but could not find the error.

    main pro file:

    @TEMPLATE = subdirs

    SUBDIRS +=
    TecTrackerAdm
    TecTrackerOpr
    Core

    OTHER_FILES += TecTracker.pri
    @

    Core.pro:

    @TEMPLATE = subdirs

    SUBDIRS +=
    dataaccess
    tests
    gui@

    dataaccess.pro:

    @#-------------------------------------------------

    Project created by QtCreator 2014-07-23T14:15:58

    #-------------------------------------------------

    QT += sql

    QT -= gui

    TARGET = dataaccess
    TEMPLATE = lib
    CONFIG += staticlib

    SOURCES += dataaccess.cpp

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

    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../gui/release/ -lgui
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../gui/debug/ -lgui
    else:unix: LIBS += -L$$OUT_PWD/../gui/ -lgui

    INCLUDEPATH += $$PWD/../gui
    DEPENDPATH += $$PWD/../gui

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../gui/release/libgui.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../gui/debug/libgui.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../gui/release/gui.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../gui/debug/gui.lib
    else:unix: PRE_TARGETDEPS += $$OUT_PWD/../gui/libgui.a
    @

    gui.pro:

    @#-------------------------------------------------

    Project created by QtCreator 2014-09-02T13:39:00

    #-------------------------------------------------

    QT += widgets sql

    TARGET = gui
    TEMPLATE = lib
    CONFIG += staticlib

    SOURCES +=
    configconnec.cpp

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

    FORMS += configconnec.ui

    copyuifile.commands = $(COPY_DIR) $$PWD/configconnec.ui $$OUT_PWD
    first.depends = $(first) copyuifile
    export(first.depends)
    export(copyuifile.commands)
    QMAKE_EXTRA_TARGETS += first copyuifile

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../DynamicQtWidgets/build/release/ -ldynamicqtwidgets
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../DynamicQtWidgets/build/debug/ -ldynamicqtwidgets
    else:unix: LIBS += -L$$PWD/../../../DynamicQtWidgets/build/ -ldynamicqtwidgets

    INCLUDEPATH += $$PWD/../../../DynamicQtWidgets/build
    DEPENDPATH += $$PWD/../../../DynamicQtWidgets/build
    @


  • Qt Champions 2017

    I suspect that your build is not able to find PRE_TARGETDEPS += $$OUT_PWD/../gui/release/libgui.a. Just check this directory and library file.



  • 'libgui.a' does not exist in the directory because it has not yet been compiled. The project must first compile 'gui.pro' and then compile 'dataaccess.pro'. I think the compilation is not happening in that order.



  • It was how I imagined it was a matter of build order. I made changes to 'Core.pro'

    @TEMPLATE = subdirs

    SUBDIRS +=
    gui
    dataaccess
    tests

    CONFIG += ordered
    @

    The error stopped


  • Qt Champions 2017

    Try to change the order of build like following ?

    SUBDIRS +=
    gui
    tests
    dataaccess



  • Yes, it was changed, as shown in my last reply here. Already working.

    Thank you for your help.

    [quote author="Dheerendra" date="1409799816"]Try to change the order of build like following ?

    SUBDIRS +=
    gui
    tests
    dataaccess[/quote]


  • Qt Champions 2017

    my bad. I did not pay attention to your last line. Please move this issue to SOLVED state by changing the question to SOLVED state.


Log in to reply