views:

1226

answers:

1

I have a project I'm working on in Qt creator that requires a third-party library. I want to add the headers to the include path for the project. How do I do this?

+3  A: 

If you are using qmake, the standard Qt build system, just add a line to the .pro file:

INCLUDEPATH += <your path>

If you are using your own build system, you create a project by selecting "Import of Makefile-based project". This will create some files in your project directory including a file named <your project name>.includes. In that file, simply list the paths you want to include, one per line. Really all this does is tell Qt Creator where to look for files to index for auto completion. Your own build system will have to handle the include paths in its own way.

Jason
Okay. This will work for me just fine. Is there a global setting for include paths?
George Edison
Not that I know of, but that doesn't mean there isn't. I don't see anything in the options that looks like that.
Jason
@Jason: It isn't working now... I have the following: `INCLUDE_PATH += "C:/users/xxx/documents/projects/xxx/include"` and it's not finding the files in there...
George Edison
Never mind. Your answer mentions `INCLUDE_PATH` but you meant `INCLUDEPATH`. I'll fix your answer :)
George Edison
Sorry about that. That's what I get for trying to do it from memory.
Jason