2012-07-30 106 views
4

我目前正在構建一個基於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 

而且無濟於事。我仍然從編譯器得到相同的消息。

任何人都可以幫助我嗎?

+1

向編譯器添加包含文件搜索路徑是通過'-I'標記完成的。另外,鏈接時可能需要添加'-L'標誌來告訴鏈接器庫的路徑。 – 2012-07-31 06:00:11

回答

0

應該這樣做:

cd /Library/Frameworks/Sparkle.framework/Headers

ln -s ../Headers Sparkle

2

我最近有在Qt的旌宇集成問題。在追蹤了一些沒有幫助的帖子之後,我能夠弄清楚我需要做些什麼才能使事情順利進行。

因此,在此之後,我決定編寫一個快速入門,讓框架的客戶端正常運行。 你可以在我的帖子中找到我的帖子:http://www.discoversdk.com/knowledge-base/using-sparkle-in-qt

+0

太棒了!謝謝你,我也有這個問題 – 2016-06-22 09:40:16