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. cannot find .h file from another directory
QtWS25 Last Chance

cannot find .h file from another directory

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 642 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.
  • T Offline
    T Offline
    tony67
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        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.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        3

        • Login

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