3

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?

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
  • I copied the framework into /System/Library/Frameworks and I was able to get it to compile. I still can't get it to link. – Roland Rabien Jul 27 '12 at 21:14

2 Answers2

2

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

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
0

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
  • 11,422
  • 11
  • 48
  • 73
  • No, this does not work because you are meant to include `FrameworkName/someheader.h`, not `someheader.h` directly. – Jake Petroules Aug 11 '10 at 08:57
  • @ Is there any specific reason you want not to include directly and include like `FrameworkName/someheader.h` ?? – liaK Aug 11 '10 at 09:09
  • 1
    Yes, that's how you're supposed to include all framework headers, and the headers inside that framework have `#include ` 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 Aug 11 '10 at 18:32