[prev in list] [next in list] [prev in thread] [next in thread]
List: gdal-dev
Subject: [gdal-dev] compiling GDAL API with gcc
From: nhv () cape ! com (Norman Vine)
Date: 2008-01-27 13:41:19
Message-ID: 20080127193100.D68BE30E7E8 () mrelay1 ! cape ! com
[Download RAW message or body]
Mattia writes:
>
> 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
This is a linker error not a compiler error
You need to link with libgdal
> the compile command I use is:
>
> gcc -I/opt/FWTools/FWTools2.4.0/include/ helloworld.c
try something like
gcc -I/opt/FWTools/FWTools2.4.0/include/ -L/opt/FWTools/FWTools2.4.0/lib
-lgdal helloworld.c
HTH
Norman
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic