how set INCLUDEPATH from subdirectory?



  • 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?



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



  • 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?



  • 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]



  • Yes I have two of them but still same error.


  • Lifetime Qt Champion

    Hi,

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



  • 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...?



  • 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.


  • Lifetime Qt Champion

    Can you show a mockup of your project tree structure ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.