2012-07-30 69 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