Better to use the macro QTM_USE_NAMESPACE instead.

================
Xizhi Zhu (Steven)

Software Engineer @ Qt
Nokia

Mobile: +358 (0)50 4801247

From: qt-mobility-feedback-bounces+xizhi.zhu=nokia....@qt.nokia.com 
[mailto:qt-mobility-feedback-bounces+xizhi.zhu=nokia....@qt.nokia.com] On 
Behalf Of ext Anisha Kaul
Sent: 18. toukokuuta 2011 11:51
To: qt-mobility-feedback@qt.nokia.com
Subject: Re: [Qt-mobility-feedback] error: ‘QtMobility’ is not a namespace-name

I have solved this:

Had to include at least one header from QtMobility :doh:

--Anisha

On 18 May 2011 13:44, Anisha Kaul 
<born.rebel...@gmail.com<mailto:born.rebel...@gmail.com>> wrote:
I did search Google before posting here, got nothing.

I am trying to compile: 
http://wiki.forum.nokia.com/index.php/Fetching_a_map_tile_in_Qt_using_Google_Maps
I am using Qt-Mobility 1.2 with Qt 4.7

_____________________________________________
and the errors I am receiving are:

MainWindow.h:7: error: ‘QtMobility’ is not a namespace-name
MainWindow.h:7: error: expected namespace-name before ‘;’ token
MainWindow.h:10: error: expected class-name before ‘{’ token
In file included from 
/opt/qtsdk-2010.05/qt/include/QtCore/qcoreapplication.h:47,
                 from /opt/qtsdk-2010.05/qt/include/QtGui/qapplication.h:45,
                 from /opt/qtsdk-2010.05/qt/include/QtGui/QApplication:1,
                 from main.cpp:2:
/opt/qtsdk-2010.05/qt/include/QtCore/qeventloop.h:51: error: expected 
initializer before ‘QtCoreModule’
make: *** [main.o] Error 1

_____________________________________________
My .pro file contains:

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

HEADERS += MainWindow.h
SOURCES += main.cpp MainWindow.cpp

QT += network
CONFIG += mobility
MOBILITY = location


_____________________________________________
The error is reported in the header file, which I have shown as follows:

#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QPaintEvent>
#include <QPixmap>

using namespace QtMobility;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow ();
    void paintEvent(QPaintEvent* paintEvent);

public slots:
    void handleNetworkData(QNetworkReply* reply);

private:
    void fetchMap(const QSize& size, qreal latitude, qreal longitude);

private:
    QNetworkAccessManager networkAccessManager;
    QPixmap mapPixmap;
}

_____________________________________________
Please guide.
--Anisha

_______________________________________________
Qt-mobility-feedback mailing list
Qt-mobility-feedback@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-mobility-feedback

Reply via email to