R: [Gdal-dev] how to link gdal to my programs?
Frank Warmerdam
warmerdam at pobox.com
Wed Jan 14 10:09:58 EST 2004
Amici Alessandro wrote:
> Pushkar,
>
>
>>I'm having a little trouble linking gdal libs. to my C++ code.
>>These are the compile errors:
>>Redstone[1234] pushkar$ g++ -g -o main
>>dwt-serial.cpp -Ierrs/ -Imisc/ -Iip/ -I../gdal-1.1.9/include/
>>dwt-serial.cpp: In function `int main(int, char **)':
>>dwt-serial.cpp:20: `GDALDataset' undeclared (first use this function)
>>dwt-serial.cpp:20: (Each undeclared identifier is reported only once
>>dwt-serial.cpp:20: for each function it appears in.)
>>dwt-serial.cpp:20: `poDataset' undeclared (first use this function)
>>dwt-serial.cpp:26: parse error before `)'
>>
>>I tried -lgdal.1.1, -lgdal.1.1.9 but neither worked. I've set the path to
>>GDAL (/rstc/user1/erc/pushkar/gdal-1.1.9/lib) in my $LD_LIBRARY_PATH
>
>
> the error you show looks like a compile error (not a link one).
> you should probably play with the -I option, i.e. try to set the absolute
> path instead of ../gdal-1.1.9/include.
In fact, from the code, it appears the C++ API is being used, but only the
C include file gdal.h included. Try including gdal_priv.h for access to
the C++ types (such as GDALDataset), or use the C equivelents
(GDALDatasetH for a a GDALDataset pointer).
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