views:

40

answers:

2

I'm using the Sparkle framework in Qt. I've added the following to my .pro file:

LIBS += -framework Sparkle
QMAKE_CXX_FLAGS += -F/path/to/the/directory/sparkle.framework/is/in

However I get a compilation error saying "Sparkle/Sparkle.h" cannot be found. Framework headers physically reside in MyFramework.framework/Headers/*.h and are included like MyFramework/*.h

What commands do I need to add to my .pro file to properly include the Sparkle framework headers?

A: 

You can use INCLUDEPATH in the .pro file.

From docs,

This variable specifies the #include directories which should be searched when compiling the project. Use ';' or a space as the directory separator.

So, in your case it will be like,

INCLUDEPATH = MyFramework.framework/Headers

where

MyFramework.framework/Headers is the physical location of the headers.

I never been used to MAC OS but still hope it helps..

Edit:

If you want to include like FrameWorkName/HeaderFile.h you can stop with specifying upto the desired folder.

For e.g,

If home/CommonFolder/FrameWorkName/HeaderFile.h is your header file's physical location, you can give the INCLUDEPATH as

INCLUDEPATH = home/CommonFolder

Now In your .cpp you can give like #include "FrameWorkName/HeaderFile.h",

liaK
No, this does not work because you are meant to include `FrameworkName/someheader.h`, not `someheader.h` directly.
Jake Petroules
@ Is there any specific reason you want not to include directly and include like `FrameworkName/someheader.h` ??
liaK
Yes, that's how you're supposed to include all framework headers, and the headers inside that framework have `#include <Framework/otherheader.h>` in them, so it HAS to be done this way. For frameworks residing in /Library/Frameworks it seems to work automagically, but anywhere else it's a problem...
Jake Petroules
A: 

The problem was that I was using QMAKE_CXXFLAGS, I needed to use QMAKE_CFLAGS for the compiler to include the headers.

Jake Petroules