我正在使用C++爲maemo製作一個Qt移動應用程序。ISO C++禁止聲明...沒有類型
我有我的類聲明,但我得到這個錯誤:
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()
是什麼上述錯誤是什麼意思?
你忘了說哪一行正是引發錯誤並給出精確的錯誤文本。這很重要。 – Jon 2011-05-08 12:18:35
親愛的喬恩。我構建過程中出現錯誤,那couses是'QGeoPositionInfoSource * gpsSource行;'在我的.h文件...確切的錯誤文本上面介紹... – 2011-05-08 12:24:01
大概'QGeoPositionInfoSource'在一些命名空間(對不起,我用過QT)。你可以檢查。 – 2011-05-08 12:32:13