ISO C++禁止声明没有类型的...
我正在使用 C++ 为 maemo 制作 Qt 移动应用程序。
我有我的类声明,但出现此错误:
ISO C++ forbids declaration of 'QGeoPositionInfoSource' with no type
我的代码如下:
phonehelper.h
#ifndef PHONEHELPER_H
#define PHONEHELPER_H
#include <QObject>
#include <QGeoPositionInfoSource>
class PhoneHelper : public QObject
{
Q_OBJECT
public:
explicit PhoneHelper(QObject *parent = 0);
void GetGPSData(const char * callbackSlot);
private:
/*
* The error occures here on the line below */
QGeoPositionInfoSource *gpsSource; // PROBLEM HERE
private slots:
void positionUpdated(const QGeoPositionInfo &info);
};
#endif // PHONEHELPER_H
phonehelper.cpp
#include "phonehelper.h"
PhoneHelper::PhoneHelper(QObject *parent) :
QObject(parent)
{
}
PhoneHelper::GetGPSData(const char *callbackSlot)
{
gpsSource = QGeoPositionInfoSource::createDefaultSource(this);
if (gpsSource) {
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(callbackSlot(QGeoPositionInfo)));
gpsSource->startUpdates();
}
}
PhoneHelper::positionUpdated(const QGeoPositionInfo &info)
{
gpsSource->stopUpdates();
delete gpsSource;
}
DEPLOYMENTFOLDERS = # file1 dir1
symbian:TARGET.UID3 = 0xE0EEBE99
symbian:TARGET.CAPABILITY += NetworkServices
# MOBILITY variable.
CONFIG += mobility
MOBILITY += location
SOURCES += main.cpp mainwindow.cpp \
phonehelper.cpp
HEADERS += mainwindow.h \
phonehelper.h
FORMS += mainwindow.ui
include(deployment.pri)
qtcAddDeployment()
Project.pro 以上错误是什么意思?
I'm using C++ to make a Qt mobile application for maemo.
I have my class declaration, but I get this error:
ISO C++ forbids declaration of 'QGeoPositionInfoSource' with no type
My code is following:
phonehelper.h
#ifndef PHONEHELPER_H
#define PHONEHELPER_H
#include <QObject>
#include <QGeoPositionInfoSource>
class PhoneHelper : public QObject
{
Q_OBJECT
public:
explicit PhoneHelper(QObject *parent = 0);
void GetGPSData(const char * callbackSlot);
private:
/*
* The error occures here on the line below */
QGeoPositionInfoSource *gpsSource; // PROBLEM HERE
private slots:
void positionUpdated(const QGeoPositionInfo &info);
};
#endif // PHONEHELPER_H
phonehelper.cpp
#include "phonehelper.h"
PhoneHelper::PhoneHelper(QObject *parent) :
QObject(parent)
{
}
PhoneHelper::GetGPSData(const char *callbackSlot)
{
gpsSource = QGeoPositionInfoSource::createDefaultSource(this);
if (gpsSource) {
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(callbackSlot(QGeoPositionInfo)));
gpsSource->startUpdates();
}
}
PhoneHelper::positionUpdated(const QGeoPositionInfo &info)
{
gpsSource->stopUpdates();
delete gpsSource;
}
Project.pro
DEPLOYMENTFOLDERS = # file1 dir1
symbian:TARGET.UID3 = 0xE0EEBE99
symbian:TARGET.CAPABILITY += NetworkServices
# MOBILITY variable.
CONFIG += mobility
MOBILITY += location
SOURCES += main.cpp mainwindow.cpp \
phonehelper.cpp
HEADERS += mainwindow.h \
phonehelper.h
FORMS += mainwindow.ui
include(deployment.pri)
qtcAddDeployment()
What does the above error mean?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有看到我必须像这样使用 QtMobility 命名空间
using namespace QtMobility;
I did not see that I had to use QtMobility namespace like this
using namespace QtMobility;