Is there an updated version of QGIS coding and compilation guide?
The current version is clearly outdated. I have been trying to compile the first example, 1_hello_world_qgis_style, though to no avail regrettably. I then adjusted my code as suggested by Tiggey here. I suppose something must be wrong with the include files as I'm still unable to compile.
My platform is Windows/cygwin; I'm using the OSGeo4W64 packages. This is the code I'm using:
//
// QGIS Includes
//
#include <qgsapplication.h>
#include <qgsproviderregistry.h>
#include <qgssinglesymbolrendererv2.h>
#include <qgsmaplayerregistry.h>
#include <qgsvectorlayer.h>
#include <qgsmapcanvas.h>
//
// Qt Includes
//
#include <QString>
#include <QApplication>
#include <QWidget>
int main(int argc, char ** argv)
{
// Start the Application
QgsApplication app(argc, argv, true);
QString myPluginsDir = "/cygdrive/c/OSGeo4W64/apps/qgis";
QString myLayerPath = "/cygdrive/c/Users/defloriv/Documents/qgis/qgis_sample_data/shapefiles";
QString myLayerBaseName = "regions";
QString myProviderName = "ogr";
// Instantiate Provider Registry
QgsProviderRegistry * preg = QgsProviderRegistry::instance(myPluginsDir);
QgsVectorLayer * mypLayer = new QgsVectorLayer(myLayerPath, myLayerBaseName, myProviderName);
QgsSingleSymbolRendererV2 *mypRenderer = new QgsSingleSymbolRendererV2(QgsSymbolV2::defaultSymbol(mypLayer->geometryType()));
QList <QgsMapCanvasLayer> myLayerSet;
mypLayer->setRendererV2(mypRenderer);
if (mypLayer->isValid())
{
qDebug("Layer is valid");
}
else
{
qDebug("Layer is NOT valid");
}
// Add the Vector Layer to the Layer Registry
QgsMapLayerRegistry::instance()->addMapLayer(mypLayer, TRUE);
// Add the Layer to the Layer Set
myLayerSet.append(QgsMapCanvasLayer(mypLayer, TRUE));
// Create the Map Canvas
QgsMapCanvas * mypMapCanvas = new QgsMapCanvas(0, 0);
mypMapCanvas->setExtent(mypLayer->extent());
mypMapCanvas->enableAntiAliasing(true);
mypMapCanvas->setCanvasColor(QColor(255, 255, 255));
mypMapCanvas->freeze(false);
// Set the Map Canvas Layer Set
mypMapCanvas->setLayerSet(myLayerSet);
mypMapCanvas->setVisible(true);
mypMapCanvas->refresh();
return app.exec();
}