Important: Please read the Qt Code of Conduct -

problem with subdirs(exe and link multi lib), please help

  • Hi guys:
    here is my subdirs organized as follow:

    --AppCommon(dist dir, save all dll lib and header)
    --AppExe(dir , the main app)
    --AppLib1(dll /lib 1)
    --AppLib2(dll /lib 2)
    --AppSubdirs( subdirs project, like .sln in vs)

    AppExe needs include library/header file in AppCommon ,because he cannot access Applib1/Applib2 dir.
    For every dll(library) project, I write a bat file ,and it is executed in the QtCreator 'custom process step'.
    Everytime qt build AppLib1 ,the bat file will copy Applib1.lib/Applib1.lib/Applib1.h to AppCommon, so that AppExe can be linked correctly .
    Same as Applib2.

    Now I create subdirs project, the .pro file look like this:

    TEMPLATE = subdirs
    CONFIG += ordered
    SUBDIRS += \
        ../AppLib1 \
        ../AppLib2 \

    and comes the problem:
    subdirs will build every project in right sequence, after using:
    CONFIG += ordered
    But he cannot execute every bat file, so AppExe always link the old library in AppCommon dir.
    Or I can specify DESTDIR = ../../AppCommon in every dll project, so the library and dll can be output to AppCommon, but the header file still is the old one and AppExe cannot scan the newest header.

    So, How can i config the subdirs to make the library AND header file output to AppCommon ?
    Any help will be appreciated.

  • Lifetime Qt Champion


    What is the issue with the header ?

    As for the libraries, they should rather be but in a common place in the build folder and linked from there.

  • Hi, SGaist.
    People in a team has different permission . for example , AppExe just can access the AppLib1.h in Appcommon folder, but he cannot access .\Applib1\AppLib1.h. So I need to copy the header to a Appcommon folder.

  • Lifetime Qt Champion

    @QtTester said in problem with subdirs(exe and link multi lib), please help:

    but he cannot access .\Applib1\AppLib1.h.

    Why not? Why such restrictions?

  • Finally i use Cmake or Bat to compile the projects.

Log in to reply