[Gdal-dev] Re: MinGW & GDAL: "[Linker error] undefined reference..."

Frank Warmerdam warmerdam at pobox.com
Mon May 31 10:21:55 EDT 2004


J.Krueger wrote:
> Frank Warmerdam wrote:
> 
>>> Mhh... the only change I see is that you're using 'GDALDatasetH' now 
>>> instead of GDALDataset. Is that all I'd have to change? As I said in 
>>> my first post - I'm a mere beginner as far as C/C++ is concerned. 
>>> Basically I'm using my need for the tool I work on as a motivation to 
>>> learn C++, so some stupid questions are to be expected... ;)
>>
>> Well, now instead of calling GetRasterXSize() (or GetXSize()?) on the
>> GDALDataset object, I am now calling GDALGetRasterXSize() and passing in
>> the GDALDatasetH.  Basically, there are C API functions corresponding to
>> most C++ methods.  Use it that way and you will be OK.
> 
> 
> Yeah, I found those - didn't read your quote thoroughly enough. So 
> basically I change any call like
> 
> <variable> = <dataset>-><instruction>;
> to
> <variable> = GDAL<instruction>(<dataset>);
> 
> and it will work? Nice!

J.

Well, it isn't always quite that simple but that rule usually works.  The
online reference docs for the methods include the name of the corresponding
C function.  You just move the object pointer you would have used into the
function call as the first argument (using the equivelent handle type).  A
few low level structures such as GDALColorEntry continue to be just structures.

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