Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qmake subdirs project
QtWS25 Last Chance

qmake subdirs project

Scheduled Pinned Locked Moved Qt Creator and other tools
qmakesubdirs
5 Posts 2 Posters 2.7k Views
  • 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
    kDohmen
    wrote on 5 May 2015, 07:05 last edited by kDohmen 5 May 2015, 08:21
    #1

    Hello,

    I read about subdirs project and wanted to apply this nice feature to my project. But I got some "undefined reference to vtable" errors. I think this comes because I made something wrong.

    My Project has multiple applications and librarys and has a directory hierarchy like this:

    • root
      • applications
        • firstApp
        • secondApp
        • thirdApp
      • librarys
        • plugins
        • systemdependent
          • myGpioLibForLinux
        • utilities
          • firstUtilitiesLib
          • secondUtilitiesLib
          • thirdUtilitiesLib

    I added for each directory a .pro-file. My root .pro-file looks like this:

    TEMPLATE = subdirs
    SUBDIRS += applications librarys
    applications.depends = librarys
    

    The .pro-file in the librarys directory looks like this:

    TEMPLATE = subdirs
    SUBDIRS += plugins systemdependent utilities
    plugins.depends = utilities
    systemdependent.depends = utilities
    

    The .pro-file in the utilities directory looks like this:

    TEMPLATE = subdirs
    SUBDIRS += firstUtilitiesLib secondUtilitiesLib thirdUtilitiesLib
    firstUtilitiesLib .depends = secondUtilitiesLib 
    thirdUtilitiesLib.depends = secondUtilitiesLib 
    

    The whole librarys branch builds without any error. Even myGpioLibForLinux which depends on secondsUtilitiesLib builds without an error. But every project in the applications branch which depends on one of the librarys fails with "undefined reference to vtable" errors.

    Do I need to create just one big subdirs .pro-file in the root directory or can I stay at my method with one subdirs .pro-file for every directory? Do the errors come from wrong usage of the subdirs or do I have another problem (everything build without errors befor!)?

    PS: what are the new code-tags here??

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexvplay
      wrote on 5 May 2015, 07:44 last edited by
      #2

      How do your applications project files look like? Do they link your built libraries with LIBS +=? The depends directive only gives information about the order of building your projects but not about linking libraries.

      ps: You can find the new code styles here (it's markdown): https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

      CoFounder of Felgo - https://felgo.com/qt

      Felgo simplifies Mobile App & Game Development with Qt
      What others say: Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kDohmen
        wrote on 5 May 2015, 08:17 last edited by
        #3

        But if depends dont give informations about how to link, why can I compile the whole library branch?
        I have one base library and every other library has to link against this (base lib in my example: secondUtilitiesLib).

        So why can I compile every lib based on secondUtilitiesLib without any LIBS += but in the applications branch it fails?

        A 1 Reply Last reply 5 May 2015, 14:15
        0
        • K kDohmen
          5 May 2015, 08:17

          But if depends dont give informations about how to link, why can I compile the whole library branch?
          I have one base library and every other library has to link against this (base lib in my example: secondUtilitiesLib).

          So why can I compile every lib based on secondUtilitiesLib without any LIBS += but in the applications branch it fails?

          A Offline
          A Offline
          alexvplay
          wrote on 5 May 2015, 14:15 last edited by
          #4

          @kDohmen Are you building static or dynamic libraries (for static libraries the header files might be enough to compile them)?

          You can also manually check the generated Makefiles if all linker flags are set up correctly for your applications projects.

          CoFounder of Felgo - https://felgo.com/qt

          Felgo simplifies Mobile App & Game Development with Qt
          What others say: Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

          K 1 Reply Last reply 7 May 2015, 13:33
          0
          • A alexvplay
            5 May 2015, 14:15

            @kDohmen Are you building static or dynamic libraries (for static libraries the header files might be enough to compile them)?

            You can also manually check the generated Makefiles if all linker flags are set up correctly for your applications projects.

            K Offline
            K Offline
            kDohmen
            wrote on 7 May 2015, 13:33 last edited by
            #5

            @alexvplay Ok, you were right. I had to add the librarys with LIBS +=.
            I think this should be descibed better in the documentation.

            1 Reply Last reply
            0

            3/5

            5 May 2015, 08:17

            • Login

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