[英]ISO C++ forbids declaration of … with no type
我正在使用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;
}
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()
上述错误是什么意思?
我没有看到必须using namespace QtMobility;
这样的QtMobility命名using namespace QtMobility;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.