Qmake project dependencies (linked libraries)

后端 未结 5 1130
执念已碎
执念已碎 2020-12-12 10:46

I have a project that links to a number of shared libraries.

Lets say project A depends on projects B and C

Ideally, I want to impose the following dependenc

5条回答
  •  眼角桃花
    2020-12-12 11:29

    I had this problem when refactoring my project, after I moved in a new DLL (pqXDot) a reusable class (from pqGraphviz).

    After adding a new DLL to my project, and adding the new DLL reference to others DLL and applications that needed it, I had in main .pro:

    TEMPLATE = subdirs
    
    SUBDIRS += \
        pqConsole \
        pqConsoleTest \
        pqSource \
        pqSourceTest \
        fdqueens \
        pqGraphviz \
        pqGraphvizTest \
        pqXDot
    

    and the rebuild caused a linker error, because pqGraphviz, the DLL being restructured, can't find pqXDot, the new DLL.

    It turns out it's sufficient to reorder the SUBDIRS list, moving the required DLL before the dependent one:

    SUBDIRS += \
        pqConsole \
        pqConsoleTest \
        pqSource \
        pqSourceTest \
        fdqueens \
        pqXDot \
        pqGraphviz \
        pqGraphvizTest
    

提交回复
热议问题