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. Include path added but still not able to include files
Forum Updated to NodeBB v4.3 + New Features

Include path added but still not able to include files

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 3 Posters 27.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.
  • K Offline
    K Offline
    Kewal
    wrote on last edited by
    #1

    I am trying to include the folder which has my include files, I am trying to add a folder in the Build environment in the QT Creator but still I am not able to include the files, Though its very less input for somebody to explain where I am going wrong,. can anybody help me

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      What are you trying to include ? Your 'own' headers or Qt ?

      You should add modules relevant to headers in your pro file. For example, if u are trying to include QSqlQuery , you should add QT += sql in pro file


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kewal
        wrote on last edited by
        #3

        yes my own headers which is grouped in a different folder,. I am adding that path of that folder to build environment

        INCLUDE C:/Users/Desktop/Test Workspace/Sourcecode

        under that sourcecode folder my header files are present.

        in my file if i just include a header which is present in that particular folder its not able to fetch ,. its says no such file or directory.
        however, if i give a specific path while including say

        #include "..\ Test Workspace\Sourcecode\enums.h"

        It gets included I do not want to do this way because it might go to an endless loop if enums.h includes someother file and that wont be able to search ..
        hope you get it

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rahul Das
          wrote on last edited by
          #4

          Try adding SOURCE and HEADERS in Pro file.

          And don't worry about the endless loop. Includes in the 'enums.h' might need it to work properly.


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kewal
            wrote on last edited by
            #5

            I included that in the pro file but still of no avail,. I am not able to find the required file.
            is there any specific way of including a folder of headers i have just added that in the INCLUDE in the build environments and added the headername in the pro file

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Show us the contents of your .pro file, at least the INCLUDEPATH snippet.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kewal
                wrote on last edited by
                #7

                @CONFIG += designer plugin debug_and_release
                CONFIG(debug, debug|release) {
                TARGET = debug_binary
                TARGET = $$qtLibraryTarget(plugind)
                } else {
                TARGET = release_binary
                TARGET = $$qtLibraryTarget(plugin)
                }

                TEMPLATE = lib

                HEADERS = progressbar.h customplugin.h Enums.h Structs.h BaseHandler.h HandlerFactory.h
                SOURCES = progressbar.cpp customplugin.cpp
                RESOURCES = icons.qrc
                LIBS += -L.
                INCLUDEPATH += "C:\Users\998234\Desktop\CustomPlugin Workspace\AppWorkspace\Sourcecode"

                target.path = $$[QT_INSTALL_PLUGINS]/designer
                INSTALLS += target

                include(progressbar.pri)@

                My pro file looks like above.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  Kewal
                  wrote on last edited by
                  #8

                  By adding the INCLUDEPATH I am able to include the necessary headers required for the project
                  However, how should i insert an relative path there instead of

                  INCLUDEPATH += "C:\Users\998234\Desktop\Custom Workspace\Custom Workspace\Customapp\Sourcecode"

                  since I am new to scripting or the makefiles, I want to know where i can find the macros to be used like

                  $$qtLibraryTarget or $$[QT_INSTALL_PLUGINS]

                  from there i can specify the path to the required folders

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Rahul Das
                    wrote on last edited by
                    #9

                    AFAIK, you should add here in headers and sources ,ie along with @HEADERS = progressbar.h customplugin.h Enums.h Structs.h BaseHandler.h HandlerFactory.h
                    SOURCES = progressbar.cpp customplugin.cpp@


                    Declaration of (Platform) independence.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      Kewal
                      wrote on last edited by
                      #10

                      Yes, thanks for it. I am able to include the headers now , but was only looking at the way of giving a relative path, instead of using a absolute path as i am doing in the INCLUDEPATH macro is there a way of providing that using some environment variables or something

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Rahul Das
                        wrote on last edited by
                        #11

                        Relative path should also work. And i don't know much about env vars :(
                        Perhaps you'll find "here":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html or "there":http://developer.qt.nokia.com/doc/qt-4.8/qmake-common-projects.html .Research. :)


                        Declaration of (Platform) independence.

                        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