[Gdal-dev] gdalwarp tutorial VS2003 compile error

Mateusz Loskot mateusz at loskot.net
Mon Feb 26 16:35:20 EST 2007

Huajun Zhang wrote:
> The code is as following:
> // Get Source coordinate system. const char *pszSrcWKT, *pszDstWKT =

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:


Because of C/C++ strong type safety, the const qualifier is not removed

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) );

Mateusz Loskot

More information about the Gdal-dev mailing list