[gdal-dev] compiling GDAL API with gcc

mattia mattia.parigiani at gmail.com
Sun Jan 27 13:32:48 EST 2008


I installed GDAL by installing FWTools (I currently have it under /opt)
Using Ubuntu 7.10
For some reason I try to compile :

#include <stdio.h>
#include "gdal.h"

int main() {

    printf("test\n");

    GDALAllRegister();

}


but get:

/tmp/cc4QzAsI.o: In function `main':
helloworld.c:(.text+0x1e): undefined reference to `GDALAllRegister'
collect2: ld returned 1 exit status


the compile command I use is:

gcc -I/opt/FWTools/FWTools2.4.0/include/ helloworld.c

where the include/ subfolder contains all the header files: gdal.h.... ecc
ecc


Have done it as super user and the same result was coming put when I have
gdal installed as from synaptic packet manager (which I now tried removing)

Does anyone know where the problem might me?
Is it the compiler? should I be using another instead of gcc..

I tried following the tutorial and this is where the C snippet have pasted
comes from ..
I deduce that I actually can write C code to use the GDAL API!!!
But then again , why doesnt it compile??

thanks for u time

-- 
Mati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080127/fb4c5487/attachment.html


More information about the gdal-dev mailing list