我目前正在構建一個基於Qt C++框架的項目,該框架利用Sparkle框架進行更新。我遇到的問題是我的整個應用程序構建得很好,除了包含Sparkle框架的時候。編譯時不能包含Sparkle框架
Sparkle.framework目錄位於/ Library/Frameworks目錄中。
在我的.pro文件,我有:
QMAKE_LFLAGS += -F /Library/Frameworks
LIBS += -framework Sparkle
在我SparkleUpdater類我有以下標題:
#include <Sparkle/Sparkle.h>
#include "SparkleUpdater.h"
,當我將鼠標懸停在包括Qt Creator中,我得到的通知其中包含:/Library/Frameworks/Sparkle.framework/Headers/Sparkle.h,它是正確的位置,實際上Sparkle.framework存在於我的機器上。
然而,當我建立我的項目,我從編譯如下:
SparkleUpdater.mm:2:29: error: Sparkle/Sparkle.h: No such file or directory
SparkleUpdater.mm:10: error: ISO C++ forbids declaration of 'SUUpdater' with no type
SparkleUpdater.mm:10: error: expected ';' before '*' token
SparkleUpdater.mm: In constructor 'SparkleUpdaterPrivate::SparkleUpdaterPrivate()':
SparkleUpdater.mm:9: error: class 'SparkleUpdaterPrivate' does not have any field named 'updater'
SparkleUpdater.mm: In constructor 'SparkleUpdater::SparkleUpdater(const QString&, bool)':
SparkleUpdater.mm:17: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm:17: error: 'SUUpdater' was not declared in this scope
SparkleUpdater.mm:18: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm:22: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm:24: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm: In destructor 'virtual SparkleUpdater::~SparkleUpdater()':
SparkleUpdater.mm:30: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm: In member function 'virtual void SparkleUpdater::checkForUpdates(bool)':
SparkleUpdater.mm:40: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm:41: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
SparkleUpdater.mm:45: error: 'class SparkleUpdaterPrivate' has no member named 'updater'
make[1]: *** [SparkleUpdater.o] Error 1
我曾嘗試拆卸和更換我的機器上閃閃發光的框架。 我曾嘗試包括頭文件明確這一點:
INCLUDEPATH += -F /Library/Frameworks
和
INCLUDEPATH += -F /Library/Frameworks/Sparkle.framework/Versions/A
而且無濟於事。我仍然從編譯器得到相同的消息。
任何人都可以幫助我嗎?
向編譯器添加包含文件搜索路徑是通過'-I'標記完成的。另外,鏈接時可能需要添加'-L'標誌來告訴鏈接器庫的路徑。 – 2012-07-31 06:00:11