[Gdal-dev] how to link gdal to my programs?

Andrey Kiselev dron at ak4719.spb.edu
Wed Jan 14 03:04:56 EST 2004


Hi,

On Tue, Jan 13, 2004 at 04:19:48PM -0600, Pushkar Pradhan wrote:
> 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

Note, that above errors has nothing with linking. It is compile time
errors. Linking flags depends on how do you compile GDAL and its
version. If you have GDAL from CVS or daily snapshot and didn't switch
off libtool support (enabled by default) then you should use -lgdal
option. Otherwise -lgdal.1.1 helps you. ARAIR, 1.1.9 was released before
libtool migration.

> #include <gdal.h>

You should use

#include <gdal_priv.h>

for C++ code.

					Best regards,
					Andrey

-- 
Andrey V. Kiselev
Home phone:  +7 812 5274898  ICQ# 26871517



More information about the Gdal-dev mailing list