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

Project Dependencies?



  • Hi everybody,

    Maybe it is a very simple problem, but i still don't get it!

    I have the following situation:

    2 Projects:

    ProjectA and ProjectB

    ProjectA is a pure framework and ProjectB should just use this framework.

    I just opened the project settings of ProjectB -> dependencies and checked the box of ProjectA.
    So far so good. If I build ProjectB, ProjectA compiles first. (Also good!)

    BUT: How can I simply use the classes/headers from ProjectA in ProjectB? Is there another way but adding every file of ProjectA in the .pro file of ProjectB???

    I used to do that with Eclipse. There u just have to set the dependencies and you can use the classes and headers...

    The compiler recognizes the complete files of ProjectA that are required. But Make says smth like: No rule to make target "xxx.cpp" needed by "xxx.o"!

    I also tried the SUBDIRS option in the .pro file of ProjectB. No change...

    I'm using MinGW if that helps...

    Big Thanks in advice!


  • Moderators

    A standard approach would to build ProjectA as a library (or several libraries), and then add them to ProjectB through standard vars in qmake:
    @
    LIBS += yourlib
    INCLUDEPATH += yourlibHeaders
    @

    And use those libs in ProjectB.



  • Does yourlibHeaders work recursive?
    Because my project consists of sub directories! And then i would have to add all the headers manually...?


  • Moderators

    The most fool-proof approach is most likely to add a new .pro file using the subdirs template that references your two existing projects. That effectively fuse your two projects into one.


Log in to reply