关于在我的Qt项目中包含QcontactObserver?

时间:2011-10-04 09:32:24

标签: qt qt-mobility

我想运行此处的示例:http://doc.qt.nokia.com/qtmobility-1.2/samplephonebook.html

但我在这一行中有错误:

QContactObserver* m_observer;

错误是:

ISO C++ forbids declaration of 'QContactObserver' with no type

contacteditor.h文件中。

怎么了?我该怎么做才能跑?

1 个答案:

答案 0 :(得分:1)

这个问题很可能已经解决了原来的OP,但是为了其他用户的绊脚石:

QContactObserverQt Mobility的一部分。尽管Qt Mobility包含在QtSDK中,但在开发系统上必须为unpacked and built,以确保它已正确配置以在该系统上的项目中使用。

此外, .pro 文件requires additions提示它包含所需的Qt Mobility标头。例如,QContactObserver QtContacts 模块的一部分,因此 .pro 文件将需要以下附加行:

CONFIG += mobility
MOBILITY += contacts

上述评论中提到的错误:

  

MBX:你确定有#include <QContactObserver>,不是吗?

     

Marwa Shams:当我加入它时..我有一个错误“没有这样的文件或目录”

发生

是因为Qt不知道在哪里查找<QContactObserver>标头。按照上述步骤解决问题。

相关问题