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. how set INCLUDEPATH from subdirectory?
QtWS25 Last Chance

how set INCLUDEPATH from subdirectory?

Scheduled Pinned Locked Moved General and Desktop
includepathpro file
9 Posts 3 Posters 4.2k 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.
  • GiorgiG Offline
    GiorgiG Offline
    Giorgi
    wrote on last edited by
    #1

    ok.

    My project is C:/Qt_projects/project_name/release_directory/release/

    Inside I have custom folder named simple_lib. now In .pro file I want to set INCLUDEPATH from that folder.
    One way is to set it from absolute path like this
    INCLUDEPATH += C:/Qt_projects/project_name/release_directory/release/simple_lib

    but I want to set it like this:
    INCLUDEPATH += /simple_lib
    or
    INCLUDEPATH += . simple_lib
    but not work.
    how to do this?

    1 Reply Last reply
    0
    • cybercatalystC Offline
      cybercatalystC Offline
      cybercatalyst
      wrote on last edited by
      #2

      You can use $$PWD which returns the path the current file is in.

      1 Reply Last reply
      0
      • GiorgiG Offline
        GiorgiG Offline
        Giorgi
        wrote on last edited by Giorgi
        #3

        I added $PWD/simple_lib or $$PWD/simple_lib but still not working.
        my header test.h still invisible.

        error: test.h: No such file or directory
        test.h is in the simple_lib directory

        What i did wrong?

        1 Reply Last reply
        0
        • cybercatalystC Offline
          cybercatalystC Offline
          cybercatalyst
          wrote on last edited by SGaist
          #4

          oops, it seems the forum swallowed a "$", it must be two of them, ie. "$$PWD"

          [edit: Corrected $ escaping to show the proper number of them]

          1 Reply Last reply
          0
          • GiorgiG Offline
            GiorgiG Offline
            Giorgi
            wrote on last edited by
            #5

            Yes I have two of them but still same error.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Where's the pro file you are calling to build that project ? In what folder did you put it ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • GiorgiG Offline
                GiorgiG Offline
                Giorgi
                wrote on last edited by Giorgi
                #7

                I created simple_lib folder into build_path/release directory where generated .exe. file. but when I set INCLUDEPATH += $$PWD/simple_lib and put .h file into than simple_lib directory minwg can't compile project because it couldn't see .h file. But after I moved .h file from build_path/release/simple_lib into build_path/release and set INCLUDEPATH += $$PWD/ it worked. As i guessed INCLUDEPATH doesn't work with sub directories...?

                1 Reply Last reply
                0
                • cybercatalystC Offline
                  cybercatalystC Offline
                  cybercatalyst
                  wrote on last edited by
                  #8

                  This is whistling a bell here. Since I last used Windows years ago using mingw, I remember there were issues with mingw not being able to properly handle includepaths. I don't remember why and how, but I leave this up to you to research on that.

                  That said, include paths support subdirectories. This will likely not be an issue with qmake.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Can you show a mockup of your project tree structure ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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