Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Dependencies issues
Forum Updated to NodeBB v4.3 + New Features

Qt Dependencies issues

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kloveridge
    wrote on last edited by
    #1

    I have a main project that is reliant on a library that I am writing.

    When I start up Qt, I load the main project and usually the library. I have to remember to go in on the main projects Dependencies tab of the project and check the library. If I don't, and I make changes to the library, the compile will forget to recompile the library when it changes.

    My question is, how do I make the main project permanently remember to compile the library when it changes?

    Here's how the library gets included in my main project:

    @win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/release/ -lUnderworld
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/debug/ -lUnderworld
    else:unix: LIBS += -L$$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/ -lUnderworld

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

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/release/libUnderworld.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/debug/libUnderworld.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/release/Underworld.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/debug/Underworld.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../build-Underworld-Desktop_Qt_5_2_1_clang_64bit-Debug/libUnderworld.a@

    I would have figured the lines:

    @INCLUDEPATH += $$PWD/../Underworld
    DEPENDPATH += $$PWD/../Underworld@

    would have done the trick. But nope.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t3685
      wrote on last edited by
      #2

      I use sessions for this via Qt Creator. The session lets you remember settings like dependencies.

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        As far as I know, the order of projects you specify in the SUBDIRS template of .pro file is important (I assume you are using SUBDIRS, but am not sure). This means that you should place your library dir name before your application's. Feel free to check out my "spdr":https://github.com/sierdzio/spdr/blob/master/spdr.pro for a live example.

        (Z(:^

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kloveridge
          wrote on last edited by
          #4

          sierdzio,
          Your solution seems to be the one I am most familiar with. It appears promising. But I still have a fundamental problem.

          I have a main project (Lotus) and a library (Underworld). My new top level .pro file looks like this now:

          @TEMPLATE = subdirs

          SUBDIRS += ../Underworld ../Lotus
          @

          In creator, it appears like I have two sub-projects under a workspace. This reminds me a lot of workspaces in XCode.

          I can edit the code in Lotus, recompile and everything is good.

          But when I edit the library Underworld, it appears to compile the changes. But when my program (Lotus) starts running, none of my changes are coming through from the Underworld.

          What else am I missing here? This is exactly the same problem I was having before. But before I could check the dependencies and it would compile fine.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            I suspect you have a deployment problem. The Release/Debug output directory contains some old DLL or SO file, and that is why you are not seeing the changes. You need to ensure that every time your application is compiled, it will take the newest version of your library.

            In my case, I use "this":https://github.com/sierdzio/spdr/blob/master/libraryIncludes.pri. It works when launching app through Qt Creator, but for running outside of QtC, I need to do manual deployment (as outlined in the documentation).

            (Z(:^

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved