[gdal-dev] GDALColorTable - can't delete it

Even Rouault even.rouault at mines-paris.org
Wed Oct 30 08:48:27 PDT 2013


Le mercredi 30 octobre 2013 16:23:34, David Strip a écrit :
> I'm having trouble with the GDALColorTable in C++ on WIn7 using Visual
> Studio 2010
> With a function as simple as
>     void foo()
>     {
>         GDALColorTable * ct = new GDALColorTable;
>         delete ct;
>       }
> 
> I've also tried
>     void foo()
>     {
>         GDALColorTable ct;
>     }
> 
> and
> 
>     void foo()
>     {
>         GDALColorTable * ct = new GDALColorTable;
>         GDALDestroyColorTable((GDALColorTableH) ct);
>     }
> 
> I get either unhandled exception or stack corruption errors.
> 
> I expect there's something simple I'm missing, but it's eluding me at
> the moment.

Check that your compilation / linking flags match the ones used for the GDAL 
library itself. The debug version of a GDAL build is known to use kind of 
unusual flags. See what is used in nmake.opt

Otherwise a pure C solution should work :

GDALColorTableH hCT = GDALCreateColorTable ( eColorInterp );
GDALDestroyColorTable(hCT);


> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list