Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Header files in a different directory problem
Forum Updated to NodeBB v4.3 + New Features

Header files in a different directory problem

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 2.0k Views 1 Watching
  • 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.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by
    #1

    I inherited a project with .cpp files in /src and .h files in /include

    I added INCLUDEPATH="include" and now the project compiles.

    However, I can not switch between header source with F4. Does this feature only work if the header file is in the same folder as the source file? (Any way around this? I hate to have to merge them all into one folder)

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

      Hi,

      AFAIK it should also work like that. Which version of Qt Creator are you using ?

      In between you can try using

      @INCLUDEPATH += $$PWD/include@

      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
      • ocgltdO Offline
        ocgltdO Offline
        ocgltd
        wrote on last edited by
        #3

        I'm using the latest Qt Creator (as part of the 5.1.1 package) direct from the qt-project site. I tried the INCLUDEPATH as you suggested but it won't work.

        I can only switch between header and source using F4 if the .h and .cpp are in the same directory. Can you confirm you are able to use different directories and switch?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andsun
          wrote on last edited by
          #4

          Hi just a note, (i'm a newbe) don't know for sure it'll work but
          Also note the '+' sign left och '='
          try '/' ahead of "include"

          for ex.
          INCLUDEPATH += "/include" \
          "../proj2-root/include2"

          or what ever path it is to your include
          proj-root
          /src
          /include

          proj2-root
          /include2

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

            Good catch, I didn't saw the missing +

            Indeed, it must be there otherwise the content of INCLUDEPATH is replaced

            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