December 21, 2011

Kewal Kewal
Lab Rat
37 posts

include path added but still not able to include files

 

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

10 replies

December 21, 2011

Rahul Das Rahul Das
Hobby Entomologist
430 posts

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

 Signature 

——————————-

    Rahul Das

——————————-

December 21, 2011

Kewal Kewal
Lab Rat
37 posts

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

December 21, 2011

Rahul Das Rahul Das
Hobby Entomologist
430 posts

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.

 Signature 

——————————-

    Rahul Das

——————————-

December 21, 2011

Kewal Kewal
Lab Rat
37 posts

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

December 22, 2011

Volker Volker
Ant Farmer
5428 posts

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

December 22, 2011

Kewal Kewal
Lab Rat
37 posts

  1. CONFIG      += designer plugin debug_and_release
  2. CONFIG(debug, debug|release) {
  3.      TARGET = debug_binary
  4.      TARGET = $$qtLibraryTarget(plugind)
  5.  } else {
  6.      TARGET = release_binary
  7.      TARGET = $$qtLibraryTarget(plugin)
  8.  }
  9.  
  10. TEMPLATE    = lib
  11.  
  12. HEADERS     = progressbar.h customplugin.h Enums.h Structs.h BaseHandler.h HandlerFactory.h
  13. SOURCES     = progressbar.cpp customplugin.cpp
  14. RESOURCES   = icons.qrc
  15. LIBS        += -L.
  16. INCLUDEPATH += "C:\Users\998234\Desktop\CustomPlugin Workspace\AppWorkspace\Sourcecode"
  17.  
  18. target.path = $$[QT_INSTALL_PLUGINS]/designer
  19. INSTALLS    += target
  20.  
  21. include(progressbar.pri)

My pro file looks like above.

December 22, 2011

Kewal Kewal
Lab Rat
37 posts

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

December 22, 2011

Rahul Das Rahul Das
Hobby Entomologist
430 posts

AFAIK, you should add here in headers and sources ,ie along with

  1. HEADERS     = progressbar.h customplugin.h Enums.h Structs.h BaseHandler.h HandlerFactory.h
  2. SOURCES     = progressbar.cpp customplugin.cpp

 Signature 

——————————-

    Rahul Das

——————————-

December 23, 2011

Kewal Kewal
Lab Rat
37 posts

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

December 23, 2011

Rahul Das Rahul Das
Hobby Entomologist
430 posts

Relative path should also work. And i don’t know much about env vars :( Perhaps you’ll find here [developer.qt.nokia.com] or there [developer.qt.nokia.com] .Research. :)

 Signature 

——————————-

    Rahul Das

——————————-

 
  ‹‹ How to favor speed over size?      Demos and examples problem ››

You must log in to post a reply. Not a member yet? Register here!