[gdal-dev] Driver pointer NULL

Frank Warmerdam warmerdam at pobox.com
Wed Mar 3 15:57:44 EST 2010


deadpickle wrote:
> I have finally compiled my C program and tried running it for the
> first time. When I ran the file I got the error:
> [thor at updraft ~/Programs]$ ./gdal_test_convert
> ERROR 10: Pointer 'hDriver' is NULL in 'OGR_Dr_CreateDataSource'.
> I'm trying to load the ESRI Shapefile driver. When I compiled it I
> linked it to the libgdal.a library. Is there something I'm missing?
> 
> #include "ogr_api.h"
> #include "ogr_srs_api.h"
> #include "stdio.h"
...
> 
> 	//~ get driver and create ds
> 	driver = OGRGetDriverByName("ESRI Shapefile");
> 	ds = OGR_Dr_CreateDataSource(driver, "testc.shp", NULL);

Dead Pickle,

I believe you need to call OGRRegisterAll() before calling the get driver
function.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list