[Gdal-dev] gdalwarp tutorial VS2003 compile error
Huajun Zhang
huajun_zhang at usgs.gov
Tue Feb 27 10:55:19 EST 2007
Thanks a lot. It works.
Huajun Zhang
Mateusz Loskot <mateusz at loskot.net>
Sent by: gdal-dev-bounces at lists.maptools.org
02/26/2007 04:35 PM
To
gdal <gdal-dev at lists.maptools.org>
cc
Subject
Re: [Gdal-dev] gdalwarp tutorial VS2003 compile error
Huajun Zhang wrote:
>
> The code is as following:
>
> // Get Source coordinate system. const char *pszSrcWKT, *pszDstWKT =
> NULL;
Here, you're declaring *const* pointers to char.
> oSRS.exportToWkt( &pszDstWKT );
Here, you pass const pointer where non-const is expected.
Also, it's a good idea to check the manual to see what types are expected:
http://www.gdal.org/ogr/classOGRSpatialReference.html#8b8123ea88b3e2ffb082e5eec06d52d5
Because of C/C++ strong type safety, the const qualifier is not removed
implicitly.
You have two choices:
1) Declare the pszDstWKT as a non-const pointer:
char* pszDstWKT = NULL;
2) Leave the pszDstWkt declared as const char* and ask the compiler to
remove the const qualifier:
oSRS.exportToWkt( const_cast<char**>(pszDstWKT) );
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070227/59a6775f/attachment.html
More information about the Gdal-dev
mailing list