Strange problem of the QgsApplication class instead of the QApplication
-
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!