[Qgis-developer] error testing core libs on new application

David Silva Barrera dsilva at uci.cu
Wed May 11 09:14:27 EDT 2011


Hi all,

I'm testing Tim Suttom's code tutorials. Those one using cmakelists work
fine, but timtut6 is configured with QT .PRO and launches me an error like
this: 

QT shows a runtime error dialog saying "This application has requested the
runtime to terminate in an unusual way"

And the application output shows (see second line): 

Starting ... qgis_example6.exe...
QWidget: Must construct a QApplication before a QPaintDevice
...qgis_example6.exe exited with code 3



This is the code:

int main(int argc, char ** argv) 
{
  // Start the Application
  QgsApplication *app = new QgsApplication(argc, argv, TRUE);
  MainWindow * mypMainWindow = new MainWindow();
  mypMainWindow->show();
  // Start the Application Event Loop
  return app->exec();
}


I tried replacing QgsApplication for QAppliction, just testing 'course, but
the same dialog and no output application QWigdet error. 


Once I used both QApplication and QgsApplication and worked well, then I
changed all the code (replacing files) and started error again.

The curious thing here: the same code works fine if configure with
cmakelists.

Here the .PRO configuration:

TEMPLATE = app
TARGET = qgis_example6
QT = qt3support sql opengl network svg gui core xml
LANGUAGE= C++
win32 {
  QGISDIR= D:/dsilva/qgis1.5.0
  QGISLIBDIR=$${QGISDIR}
  QGISSRCDIR= D:/dsilva/qgis/src
  QGISPLUGINDIR=$${QGISLIBDIR}/qgis
  OSGEO= C:/Osgeo4W
  DEFINES += QGISPLUGINDIR=$${QGISPLUGINDIR}
CORE_EXPORT=__declspec(dllimport) GUI_EXPORT=__declspec(dllimport)
  LIBS = -L$${QGISLIBDIR} D:/dsilva/qgis1.5.0/libqgis_core.dll
C:/OSGeo4W/lib/proj.lib D:/dsilva/qgis1.5.0/libqgis_gui.dll
}

INCLUDEPATH = $${QGISDIR}/include \
              $${OSGEO}/include\
              $${QGISSRCDIR}/core \
              $${QGISSRCDIR}/core/renderer \
              $${QGISSRCDIR}/core/raster \
              $${QGISSRCDIR}/gui \
              $${QGISSRCDIR}/plugins \
              $${QGISSRCDIR}/providers \
              $${QGISSRCDIR}/raster \
              $${QGISSRCDIR}/ui 

CONFIG += qt gui exceptions stl warn_on debug thread

RESOURCES += resources.qrc

FORMS += mainwindowbase.ui

HEADERS = mainwindow.h \
    maptooldriller.h

SOURCES = main.cpp \
          mainwindow.cpp \
    maptooldriller.cpp






More information about the Qgis-developer mailing list