Hi Qt-Experts,
I am a newbie in QT development. I am trying to introduce new position info source class which is a derived class of the QGeoPositionInfoSource. This derived class would be making communication with the GPS device through a customer GPS software. I am having a difficult time in compiling this sample class to do this activity. I keep getting below error when I compile the code
c_qgeopositioninfosource_linux_p.o ../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:48: error: âQGeoPositionInfoSourceLinuxâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:49: error: âQGeoPositionInfoSourceâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:57: error: âQGeoPositionInfoSourceLinuxâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:57: error: non-member function âconst QMetaObject* metaObject()â cannot have cv-qualifier
/usr/include/qt4/QtCore/qobject.h: In function âconst QMetaObject* metaObject()â:
/usr/include/qt4/QtCore/qobject.h:296: error: âQScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > QObject::d_ptrâ is protected
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:59: error: within this context
/usr/include/qt4/QtCore/qobject.h:296: error: invalid use of non-static data member âQObject::d_ptrâ
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:59: error: from this location
/usr/include/qt4/QtCore/qobject.h:296: error: âQScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > QObject::d_ptrâ is protected
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:59: error: within this context
/usr/include/qt4/QtCore/qobject.h:296: error: invalid use of non-static data member âQObject::d_ptrâ
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:59: error: from this location
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp: At global scope:
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:62: error: âQGeoPositionInfoSourceLinuxâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp: In function âvoid* qt_metacast(const char*)â:
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: expected type-specifier before âQGeoPositionInfoSourceLinuxâ
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: expected â>â before âQGeoPositionInfoSourceLinuxâ
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: expected â(â before âQGeoPositionInfoSourceLinuxâ
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: âQGeoPositionInfoSourceLinuxâ was not declared in this scope
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: expected primary-expression before â>â token
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: invalid use of âthisâ in non-member function
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:66: error: expected â)â before â;â token
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:67: error: âQGeoPositionInfoSourceâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp: At global scope:
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:70: error: âQGeoPositionInfoSourceLinuxâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp: In function âint qt_metacall(QMetaObject::Call, int, void**)â:
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:72: error: âQGeoPositionInfoSourceâ has not been declared
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:77: error: âstartUpdatesâ was not declared in this scope
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:78: error: âstopUpdatesâ was not declared in this scope
../../build/Debug/QtLocation/moc/moc_qgeopositioninfosource_linux_p.cpp:79: error: ârequestUpdateâ was not declared in this scope
My qgeopositioninfosource_linux_p.h is as below:
#ifndef QGEOPOSITIONINFOSOURCELINUX_H
#define QGEOPOSITIONINFOSOURCELINUX_H
#include "qgeopositioninfosource.h"
QTM_BEGIN_NAMESPACE
class QGeoPositionInfoSourceLinux : public QGeoPositionInfoSource
{
Q_OBJECT
public:
QGeoPositionInfoSourceLinux(QObject *parent = 0);
virtual QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const;
virtual PositioningMethods supportedPositioningMethods() const;
virtual int minimumUpdateInterval() const;
public Q_SLOTS:
void startUpdates();
void stopUpdates();
void requestUpdate(int timeout = 5000);
};
QTM_END_NAMESPACE
#endif
I am just unable to resolve this error that is reported when compiling the moc file. Any help from QT experts to resolve this error is highly appreciated.
BR,
-Raghu
Bookmarks