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?
The problem was that I was using QMAKE_CXXFLAGS
, I needed to use QMAKE_CFLAGS
for the compiler to include the headers.
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"
,
精彩评论