Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Errors encountered with Maps Demo Tutorial

Errors encountered with Maps Demo Tutorial

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 2 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goosebumps4
    wrote on last edited by
    #1

    I am trying to create an app that will work with the Ovi Maps. I tried implementing this example: http://doc.qt.nokia.com/qtmobility-1.2/tutorials-mapsdemo-part1.html

    But I have been prompted with 3 errors:
    @/Users/andreibechet/Work/Nokia Project/Qt/Testing/Maps03-build-simulator/../Maps03/geomap.h:16: error: 'MapsWidget' has not been declared@
    @/Users/andreibechet/Work/Nokia Project/Qt/Testing/Maps03-build-simulator/../Maps03/geomap.h:20: error: ISO C++ forbids declaration of 'MapsWidget' with no type@
    @/Users/andreibechet/Work/Nokia Project/Qt/Testing/Maps03-build-simulator/../Maps03/geomap.h:20: error: expected ';' before '*' token@

    Here is the code
    geomap.h
    @#ifndef GEOMAP_H
    #define GEOMAP_H

    #include "mapswidget.h"

    #include <QGraphicsGeoMap>

    QTM_USE_NAMESPACE

    class GeoMap : public QGraphicsGeoMap
    {
    Q_OBJECT

    public:
    GeoMap(QGeoMappingManager *manager, MapsWidget *mapsWidget);
    ~GeoMap();

    private:
    MapsWidget *mapsWidget;

    };

    #endif // GEOMAP_H
    @

    geomap.cpp
    @#include "geomap.h"

    GeoMap::GeoMap(QGeoMappingManager *manager, MapsWidget *mapsWidget) :
    QGraphicsGeoMap(manager), mapsWidget(mapsWidget)
    {
    }
    @

    mapswidget.h
    @#ifndef MAPSWIDGET_H
    #define MAPSWIDGET_H

    #include "mapswidgetprivate.h"

    #include <QWidget>
    #include <QGeoMappingManager>

    QTM_USE_NAMESPACE

    class MapsWidget : public QWidget
    {
    Q_OBJECT

    public:
    MapsWidget(QWidget *parent = 0);
    ~MapsWidget();

    public slots:
    void initialize(QGeoMappingManager *manager);

    private:
    MapsWidgetPrivate *d;

    };

    #endif // MAPSWIDGET_H
    @

    mapswidget.cpp
    @#include "mapswidget.h"

    MapsWidget::MapsWidget(QWidget *parent) :
    QWidget(parent)
    {
    }
    @

    mapswidgetprivate.h
    @#ifndef MAPSWIDGETPRIVATE_H
    #define MAPSWIDGETPRIVATE_H

    #include "geomap.h"

    #include <QGraphicsView>
    #include <QGraphicsScene>
    #include <QGeoCoordinate>

    QTM_USE_NAMESPACE

    class MapsWidgetPrivate
    {
    public:
    GeoMap *map;
    QGraphicsView *view;

    // MapsWidgetPrivate();
    };

    #endif // MAPSWIDGETPRIVATE_H
    @

    mapswidgedprivate.cpp
    @#include "mapswidgetprivate.h"

    void MapsWidget::initialize(QGeoMappingManager *manager)
    {
    d->map = new GeoMap(manager, this);

     QGraphicsScene *sc = new QGraphicsScene;
     sc->addItem(d->map);
    
     d->map->resize(300, 480);
    
     d->view = new QGraphicsView(sc, this);
     d->view->setVisible(true);
     d->view->setInteractive(true);
    
     d->map->setCenter(QGeoCoordinate(-27.5796, 153.1));
     d->map->setZoomLevel(15);
    

    }
    @

    main.cpp
    @#include "mapswidget.h"

    #include <QtGui/QApplication>
    #include <QGeoServiceProvider>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    MapsWidget w;
    w.show();
    
    QGeoServiceProvider *serviceProvider = new QGeoServiceProvider("nokia");
    
    w.initialize(serviceProvider->mappingManager());
    
    return app.exec();
    

    }

    @

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thisisbhaskar
      wrote on last edited by
      #2

      Did you add mapswidget.h to HEADERS section of your .pro file???

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goosebumps4
        wrote on last edited by
        #3

        Here is the pro file:

        @# Add files and directories to ship with the application

        by adapting the examples below.

        file1.source = myfile

        dir1.source = mydir

        DEPLOYMENTFOLDERS = # file1 dir1

        symbian:TARGET.UID3 = 0xEDF1E0C2

        Smart Installer package's UID

        This UID is from the protected range

        and therefore the package will fail to install if self-signed

        By default qmake uses the unprotected range value if unprotected UID is defined for the application

        and 0x2002CCCF value if protected UID is given to the application

        #symbian:DEPLOYMENT.installer_header = 0x2002CCCF

        Allow network access on Symbian

        symbian:TARGET.CAPABILITY += NetworkServices

        If your application uses the Qt Mobility libraries, uncomment

        the following lines and add the respective components to the

        MOBILITY variable.

        CONFIG += mobility
        MOBILITY += location

        SOURCES += main.cpp
        mapswidget.cpp
        mapswidgetprivate.cpp
        geomap.cpp
        HEADERS +=
        mapswidget.h
        mapswidgetprivate.h
        geomap.h
        FORMS += mainwindow.ui

        Please do not modify the following two lines. Required for deployment.

        include(deployment.pri)
        qtcAddDeployment()
        @

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thisisbhaskar
          wrote on last edited by
          #4

          There is a circular inclusion of header files.. that causes the problem

          mapswidget.h has mapswidgetprivate.h included
          mapswidgeetprivate.h has geomap.h include
          geomap.h has mapswidet.h included

          To solve it
          @#ifndef GEOMAP_H
          #define GEOMAP_H

          //#include "mapswidget.h" // remove this line Vijaya Bhaskar Reddy

          #include <QGraphicsGeoMap>

          QTM_USE_NAMESPACE

          class MapsWidget; //add this line Vijaya Bhaskar Reddy
          class GeoMap : public QGraphicsGeoMap
          {
          Q_OBJECT

          public:
          GeoMap(QGeoMappingManager *manager, MapsWidget *mapsWidget);
          ~GeoMap();

          private:
          MapsWidget *mapsWidget;

          };

          #endif // GEOMAP_H@

          And
          @
          #include "mapswidgetprivate.h"
          #include "mapswidget.h" // this is what I have added Vijaya Bhaskar Reddy

          void MapsWidget::initialize(QGeoMappingManager *manager)
          {
          d->map = new GeoMap(manager, this);

           QGraphicsScene *sc = new QGraphicsScene;
           sc->addItem(d->map);
          
           d->map->resize(300, 480);
          
           d->view = new QGraphicsView(sc, this);
           d->view->setVisible(true);
           d->view->setInteractive(true);
          
           d->map->setCenter(QGeoCoordinate(-27.5796, 153.1));
           d->map->setZoomLevel(15);
          

          }
          @

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goosebumps4
            wrote on last edited by
            #5

            Thank you for the reply, but it still doesn't work. Here are the errors ... really odd ones too.

            @:-1: error: symbol(s) not found for architecture x86_64@
            @:-1: error: collect2: ld returned 1 exit status@

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thisisbhaskar
              wrote on last edited by
              #6

              What is your OS.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goosebumps4
                wrote on last edited by
                #7

                Mac OS 10.6.8 with QT Creator 2.2.1

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  thisisbhaskar
                  wrote on last edited by
                  #8

                  ok.. will "this":http://developer.qt.nokia.com/forums/viewthread/5665/ thread help you. Looks similar to me.

                  or "this":http://developer.qt.nokia.com/forums/viewthread/6924

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goosebumps4
                    wrote on last edited by
                    #9

                    Thank you. I will look for my solution there.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved