cannot find .h file from another directory



  • Hi All,
    sorry this is almost certainly an easy answer but I can't work it out, I've done a search but with no luck. I'm used to c++ makefiles so using pro is a bit of a magic art.
    What I've be done is add qcustomplot source directory to my project. It shows up in my project tree in source and headers inside it's directory. However when I try to use the .h file from my source I get an error, "qcustomplot.h no file or directory". My directory structure is as follows
    master directory
    |
    |-----------master directory-Desktop-Debug
    |-----------master directory-Qt_5_0_1_qt5-Debug
    |----------master directory
    |----------qcustomplot-source

    looking up online I tried to add the directory to my projects via adding this to my .pro file "INCLUDEPATH += $$QT_PROJECT_DIR/qcustomplot-source/" and setting the path to the .h with #include "qcustomplot-source/qcustomplot.h" no luck. with just #include "qcustomplot.h" no luck either.
    Can anyone advise what I need to do to get .pro to include paths to external headers?
    Thanks in advance


  • Moderators

    Where is the *.pro file located?
    You can try to put absolute path to check whether it is working then:
    INCLUDEPATH += c:/.../qcustomplot-source

    What is QT_PROJECT_DIR ?



  • Add the following in your .pro file
    INCLUDEPATH += DIR which contains the your .h file

    e.g INCLUDEPATH += /Users/tony/qcustomplot.h

    Clean, run the qmake and build it again.


Log in to reply
 

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