Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have written a QGIS plugin (RTools) which acts mostly like a independent plugin (minimal interaction with QGIS core functions). On Linux both QGIS and RTools were build using QT 4.8 on Qt creator. Everything worked well.

I wanted to make it available on windows too. When I was reading the 'How to build section' of QGIS, it says now QGIS is built on Visual Studio and Mingw is no more supported. My plugin RTools built well with mingw but not on Visual Studio.

What would be a suitable approach/ work around to get this working.

I have posted this before but did not describe and was not precise. Hence reposting.

Thank you. Srikanth

Update

Some progress !!! I am now able to compile under mingw.

I have built qgis1.7.4 under mingw as qgis1.8 depends on spatialindex lib ( I could not build it under mingw). All plugins and binaries are built. When executing, it is not able to load provider or plugins. It shows a message:

"No QGIS data provider plugins found in:
/plugins
No vector layers can be loaded. Check your QGIS installation  " . 

All are built under debug. This is the path information printed on console when run

Application Settings:
--------------------------

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 574: (QgisApp) Application state

Prefix              :

Plugin Path         : /plugins 

Package Data Path   : /.

Active Theme Name   : default

Active Theme Path   : :/images/themes/default/

Default Theme Path  : :/images/themes/default/

SVG Search Paths    : /./svg/

C:/Users/user/.qgis/svg/

User DB Path        : /./resources/qgis.db


Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 575: (QgisApp)

-------------------------- 

It is clear that the prefix is empty. How can I set it so as to load the providers and plugins ?? Thank you. Srikanth


Complete trace

user@optima1 /d/QGis/qgis-1.7.4/qgis-1.7.4_Build/src/app
$ qgis
Warning: QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
Warning: QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
Warning: loading of qgis translation failed [/./i18n//qgis_en_US]
Warning: loading of qt translation failed [E:/dependencies/qt-everywhere-opensource-src-4.8.4/qt4.8.4/translations/qt_en_US]
Warning: QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 6789: (namUpdate) setCacheDirectory: C:/Users/user/.qgis/cache
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 6790: (namUpdate) setMaximumCacheSize: 52428800
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 6793: (namUpdate) cacheDirectory: C:/Users/user/.qgis/cache/
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 6794: (namUpdate) maximumCacheSize: 52428800
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 43: (setMapUnits) Map units set to 2
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 138: (calculateGeographicDistance) Distance across map extent (m): 0
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 89: (calculate) Using conversionFactor of 39.3701
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 92: (calculate) Can't calculate scale from the input values
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/gui/qgsmapcanvasmap.cpp: 47: (resize) resizing to 1x1
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 194: (adjustExtentToSize) Map units per pixel (x,y) : 0, 0

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file
Warning: QMetaObject::connectSlotsByName: No matching signal for on_buttonBox_rejected()
Warning: QMetaObject::connectSlotsByName: No matching signal for on_buttonBox_helpRequested()
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgsmeasuredialog.cpp: 266: (convertMeasurement) We're measuring on an ellipsoid or using projections, the system is returning meters
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgsmeasuredialog.cpp: 266: (convertMeasurement) We're measuring on an ellipsoid or using projections, the system is returning meters
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file
Warning: QObject: Cannot create children for a parent that is in a different thread.
(Parent is QgsMapCanvas(0x4c6fe28), parent's thread is QThread(0x4ab27b0), current thread is QThread(0x4c18438)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file
Warning: QMetaObject::connectSlotsByName: No matching signal for on_buttonBox_rejected()
Warning: QMetaObject::connectSlotsByName: No matching signal for on_buttonBox_helpRequested()
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgsmeasuredialog.cpp: 266: (convertMeasurement) We're measuring on an ellipsoid or using projections, the system is returning meters
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgsmeasuredialog.cpp: 266: (convertMeasurement) We're measuring on an ellipsoid or using projections, the system is returning meters
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file
Warning: QObject: Cannot create children for a parent that is in a different thread.
(Parent is QgsMapCanvas(0x4c6fe28), parent's thread is QThread(0x4ab27b0), current thread is QThread(0x4c18438)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file

(Parent is QgsMapCanvas(0x4c6fe28), parent's thread is QThread(0x4ab27b0), current thread is QThread(0x4c18438)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsdistancearea.cpp: 105: (setEllipsoid) Can't open database: unable to open database file
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 43: (setMapUnits) Map units set to 2
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 138: (calculateGeographicDistance) Distance across map extent (m): 0
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 89: (calculate) Using conversionFactor of 39.3701
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 92: (calculate) Can't calculate scale from the input values
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Warning: QObject: Cannot create children for a parent that is in a different thread.
(Parent is QgsMapCanvas(0x4c6fe28), parent's thread is QThread(0x4ab27b0), current thread is QThread(0x4c18438)
Warning: QMetaObject::connectSlotsByName: No matching signal for on_cbxEnableTopologicalEditingCheckBox_stateChanged(int)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 830: (updateFullExtent) called.
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 887: (updateFullExtent) Full extent: Empty
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 223: (render) ========== Rendering ==========
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 227: (render) empty extent... not rendering
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 664: (setDestinationCrs) * Setting destCRS : =
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 665: (setDestinationCrs) * DestCRS.srsid() = 7
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 668: (setDestinationCrs) Setting DistArea CRS to 7
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 830: (updateFullExtent) called.
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 887: (updateFullExtent) Full extent: Empty
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 664: (setDestinationCrs) * Setting destCRS : =
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 665: (setDestinationCrs) * DestCRS.srsid() = 7
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 668: (setDestinationCrs) Setting DistArea CRS to 7
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatereferencesystem.cpp: 220: (loadFromDb) failed : /./resources/srs.db does not exist!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgscoordinatetransform.cpp: 144: (initialise) SourceCRS seemed invalid!
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 830: (updateFullExtent) called.
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 887: (updateFullExtent) Full extent: Empty
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/gui/qgsmaptool.cpp: 82: (activate) Cursor has been set
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsproviderregistry.cpp: 83: (QgsProviderRegistry) Checking /plugins for provider plugins
Warning: QMetaObject::connectSlotsByName: No matching signal for on_checkBox_toggled(bool)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 4578: (loadPythonSupport) load library libqgispython (1.7.4)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 4586: (loadPythonSupport) Couldn't load Python support library: Cannot load library libqgispython: The specified module could not be fo
Warning: Couldn't load Python support library: Cannot load library libqgispython: The specified module could not be found.
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgspluginregistry.cpp: 431: (restoreSessionPlugins) Plugin loading completed
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/raster/qgsrasterlayer.cpp: 197: (buildSupportedRasterFileFilter) Entered
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/raster/qgsrasterlayer.cpp: 2025: (loadProviderLibrary) theProviderKey = gdal
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/raster/qgsrasterlayer.cpp: 2029: (loadProviderLibrary) myLibPath =
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/raster/qgsrasterlayer.cpp: 2051: (loadProviderLibrary) Library name is
Warning: QgsRasterLayer::loadProviderLibrary: Failed to load
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/raster/qgsrasterlayer.cpp: 201: (buildSupportedRasterFileFilter) Could not load gdal provider library
Warning: QObject::connect: Cannot connect (null)::aboutToQuit() to QgisApp::saveWindowState()

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/gui/qgsmapcanvasmap.cpp: 47: (resize) resizing to 1334x742
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 194: (adjustExtentToSize) Map units per pixel (x,y) : 0, 0

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 195: (adjustExtentToSize) Pixmap dimensions (x,y) : 1334, 742

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 196: (adjustExtentToSize) Extent dimensions (x,y) : 0, 0

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 197: (adjustExtentToSize) Empty
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 138: (calculateGeographicDistance) Distance across map extent (m): 0
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsscalecalculator.cpp: 89: (calculate) Using conversionFactor of 39.3701
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 208: (adjustExtentToSize) Scale (assuming meters as map units) = 1:0
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 223: (render) ========== Rendering ==========
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/core/qgsmaprenderer.cpp: 227: (render) empty extent... not rendering
Warning: QMetaObject::connectSlotsByName: No matching signal for on_cbxDisableTips_toggled(bool)
Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 573: (QgisApp)


Application Settings:
--------------------------

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 574: (QgisApp) Application state:
Prefix              :
Plugin Path         : /plugins
Package Data Path   : /.
Active Theme Name   : default
Active Theme Path   : :/images/themes/default/
Default Theme Path  : :/images/themes/default/
SVG Search Paths    : /./svg/
C:/Users/user/.qgis/svg/
User DB Path        : /./resources/qgis.db

Debug: d:/QGis/qgis-1.7.4/qgis-1.7.4/src/app/qgisapp.cpp: 575: (QgisApp)
--------------------------
share|improve this question
    
What is Rtools.dll , a compiled plugin ? –  gene Apr 16 '13 at 16:14
    
Yes. I am facing the same problem with grassplugin also. –  Srikanth Apr 17 '13 at 3:30
    
Hello, Let me ask in this way. What compiler or environment should I use to build my plugin. Presently the QGIS is build from vs10. Rtools.dll plugin was compiled using mingw as this was developed for cross platform applications. –  Srikanth Apr 19 '13 at 13:35
    
Srikanth: Please set the QGIS_PREFIX_PATH environment variable, so qgis will know where your directory with lib{providername}provider.[so|dll] resides. –  Matthias Kuhn Apr 24 '13 at 11:55
    
Hello Kuhn, Thank you. Tried doing that from mingw terminal (using set and export both) and also system environment window. export QGIS_PREFIX_PATH=D:/QGis/qgis-1.7.4/qgis-1.7.4_Build/src/plugins. Did not help. Still the problem persists. Is QGIS_PREFIX_PATH applicable for 1.7.4 version too ? –  Srikanth Apr 24 '13 at 14:39
show 4 more comments

1 Answer 1

As the question has evolved, sorry for the answer not really matching the title.

When building a custom application using the QGIS libraries, or running stock QGIS, you have to tell the QGIS core, where it will find these libraries (especially the providers). The PyQGIS cookbook contains information which also applies to C++ applications.

This can either be done by setting an appropriate environment variable in a startup script

set QGIS_PREFIX_PATH=C:\Path\To\QGIS\Installation
qgis.exe

or by calling the method QgsApplication::setPrefixPath() before calling QgsApplication::init()

QgsApplication::setPrefixPath( "C:\Path\ToQGIS\Installation" );
QgsApplication::init();
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.