[Qgis-developer] Please, help with plugin compilation

Anibal Alarcon anibal.alarcon at gmail.com
Thu Oct 29 14:23:01 EDT 2009


We follow the steps of "Writing a QGIS Plugin in C++" in Quantum GIS -
Coding and Compilation Guide pdf, we were able to build the libraries
with QTCreator (libpointconverter.so), but disappears when the plugin
is loaded in QGIS: automatically closes!
-QGIS version is 1.4 Trunk
-SO is Debian Lenny
-Qt Creator 1.2.1 based on Qt 4.5.3 (32 bit)

QGIS was compiled without problems, connect to Postgres/postgis and
Shapefiles sucessfull.

This is the pointconverter.pro

QGIS_DIR = /home/victor/apps
QGIS_DIR_DEV = /home/victor/dev/cpp/qgis
TEMPLATE = lib
CONFIG = qt
QT += xml qt3support
unix:LIBS += -L/$$QGIS_DIR/lib -lqgis_core -lqgis_gui
INCLUDEPATH += $$QGIS_DIR_DEV/src/ui $$QGIS_DIR_DEV/src/plugins
$$QGIS_DIR_DEV/src/gui \
       $$QGIS_DIR_DEV/src/core/raster $$QGIS_DIR_DEV/src/core $$QGIS_DIR_DEV
SOURCES = qgspointconverterplugin.cpp
HEADERS = qgspointconverterplugin.h
DEST = pointconverterplugin.so
DEFINES += GUI_EXPORT= CORE_EXPORT=

------------------------------------------------------------------------------------
// $$QGIS_DIR_DEV/src/core/raster is correct??



This is the qgspointconverterplugin.h

#ifndef QGSPOINTCONVERTERPLUGIN_H
#define QGSPOINTCONVERTERPLUGIN_H
#include "qgisplugin.h"
#include <QObject>
class QAction;
class QgsGeometry;
class QTextStream;
/**A plugin that converts vector layers to delimited text point files.
 The vertices of polygon/line type layers are converted to point features*/
class QgsPointConverterPlugin: public QObject, public QgisPlugin
{
  Q_OBJECT
 public:
  QgsPointConverterPlugin(QgisInterface* iface);
  ~QgsPointConverterPlugin();
  void initGui();
  void unload();
 private:
  QgisInterface* mIface;
  QAction* mAction;
   private slots:
   void convertToPoint();
//private:
   void convertPoint(QgsGeometry* geom, const QString&
attributeString,QTextStream& stream) const;
   void convertMultiPoint(QgsGeometry* geom, const QString&
attributeString,QTextStream& stream) const;
   void convertLineString(QgsGeometry* geom, const QString&
attributeString,QTextStream& stream) const;
   void convertMultiLineString(QgsGeometry* geom, const QString&
attributeString,QTextStream& stream) const;
   void convertPolygon(QgsGeometry* geom, const QString&
attributeString,QTextStream& stream) const;
   void convertMultiPolygon(QgsGeometry* geom, const QString&
attributeString,QTextStream& stream) const;
};
#endif
-------------------------------------------------------------------------------------
Also exist the file qgspointconverterplugin.cpp

thanks for your help.

regards.
Anibal


More information about the Qgis-developer mailing list