Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Strange problem of the QgsApplication class instead of the QApplication
Forum Updated to NodeBB v4.3 + New Features

Strange problem of the QgsApplication class instead of the QApplication

Scheduled Pinned Locked Moved Installation and Deployment
1 Posts 1 Posters 1.8k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Computerist
    wrote on last edited by
    #1

    Now I develop an application that based on the "Quantum GIS":http://qgis.org/ libraries. I begin with very simple program:

    @// QGIS Includes
    //
    #include <qgsapplication.h>
    #include <qgsproviderregistry.h>
    #include <qgssinglesymbolrenderer.h>
    #include <qgsmaplayerregistry.h>
    #include <qgsvectorlayer.h>
    #include <qgsmapcanvas.h>
    //
    // Qt Includes
    //
    #include <QString>
    #include <QApplication>
    #include <QWidget>

    int main(int argc, char *argv[])
    {
    QgsApplication app(argc, argv, true);
    return app.exec();
    }
    @
    Okay, when I build this console application and start it under command line of the Quantum GIS shell ("OSGeo4W":http://trac.osgeo.org/osgeo4w/), it fails with a strange message "QApplication::exec: Please instantiate the QApplication object first"; if I exchange a "QgsApplication":http://doc.qgis.org/stable/classQgsApplication.html to a QApplication class, the program start without an error. But the QgsApplication is a child of a QApplication class, as described in the Quantum GIS documentation. What's wrong, I'm confused!

    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