I followed the instructions here:
How to install QGIS on Centos 6?
If I run:
QgsVectorLayer * vpoly = new QgsVectorLayer("Polygon", "pointbuffer", "memory");
QgsVectorDataProvider * provider = vpoly->dataProvider();
Then provider is a NULL pointer
Also, if I do:
QString myPluginsDir = "/usr/lib64/qgis";
QgsProviderRegistry * preg = QgsProviderRegistry::instance(myPluginsDir);
QString pluglist=preg->pluginList();
printf("plugins: %s\n",pluglist.toStdString().c_str());
Then it prints:
plugins: No data provider plugins are available. No vector layers can be loaded
Also, when I try to load a QgsVectorLayer with the following:
QgsVectorLayer * mypLayer = new QgsVectorLayer(myLayerPath, myLayerBaseName, myProviderName);
if (mypLayer->isValid()){
qDebug("Layer is valid");
} else {
qDebug("Layer is NOT valid");
return;
}
Then it says that the layer is NOT valid.
This all works just fine in Ubuntu, but I can't get it to work in centos. I think maybe it's missing all the plugins. What am I missing?
Please help.