ISO C++禁止声明 ..没有类型
ISO C++ forbids declaration of ... with no type
我正在使用C++为maemo制作Qt移动应用程序。
我有我的类声明,但出现此错误:
ISO C++ forbids declaration of 'QGeoPositionInfoSource' with no type
我的代码如下:
电话助手.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
电话助手.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()
上述错误是什么意思?
我没有看到我必须像这样使用QtMobility命名空间using namespace QtMobility;
相关文章:
- 将类型声明为类型模板参数的模板参数的一部分是否合法?
- 当返回类型声明为 ListNode 时,我们是否可以返回 false<T>*
- 如何使用自定义类型声明Arduino数组?
- 将函数参数类型声明为 auto
- 使用typedef'ed返回类型声明友元函数时出现编译器错误
- 在没有标识符的情况下如何读取复杂的C++类型声明?
- 模板函数参数显式类型声明
- 使用指针遍历一系列基元类型声明?
- 字符类型声明和验证
- 使用本地类型声明的G lambda被使用但从未定义 - 确实是一个错误
- 为什么 c++ lambda 捕获不需要类型声明?
- 为什么没有"int"类型声明时输出不同?
- C++如何使用虚拟基类型声明全局静态分配的变量
- 我可以使用预处理器将一个类型声明替换为另一个类型声明吗?
- 如何将数据类型声明从.cpp文件传输到 .cu 文件
- C++17 枚举类型声明
- 条件类型声明
- 具有特定参数的特定构造函数的类型声明
- 我可以使用相同的名称为周围作用域中的类型声明成员类型别名吗
- 函数调用之前,C 类型声明