ISO C++ forbids declaration de ... avec aucun type de

Je suis à l'aide de C++ pour faire un Qt application mobile pour maemo.

J'ai ma déclaration de classe, mais j'ai cette erreur:

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

Mon code est le suivant:

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;
}

Projet.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()

Que fait l'erreur ci-dessus signifie?

  • Vous avez oublié de dire quelle ligne exactement qui déclenche l'erreur et de donner le texte de l'erreur. Ce qui est important.
  • Chers Jon.. j'obtiens le message d'erreur pendant la phase de construction, la ligne que des couses il est QGeoPositionInfoSource *gpsSource; dans mon .h fichier... Le texte de l'erreur est présenté ci-dessus...
  • Probablement QGeoPositionInfoSource est en quelque espace de noms (désolé, j'ai utilisé QT). Vous pourriez vérifier.
  • Êtes-vous sûr que <QGeoPositionInfoSource> est vraiment inclus et qu'il contient de la déclaration de QGeoPositionInfoSource classe? Vous pouvez le vérifier en ajoutant de l'avant de la déclaration de class QGeoPositionInfoSource; juste avant PhoneHelper déclaration de classe.
InformationsquelleAutor | 2011-05-08