[GRASSLIST:332] gis.h problem

Hei,

I have GRASS 6 installed, but I can’t seem do have GIS library

$ gcc main.c
main.c:8:17: error: gis.h: No such file or directory

Why does this happen?
What must I do ?

Thanks

Ana Soares wrote:

I have GRASS 6 installed, but I can't seem do have GIS library

$ gcc main.c
main.c:8:17: error: gis.h: No such file or directory

Why does this happen?
What must I do ?

GRASS doesn't install headers into the system header directories (e.g.
/usr/include), but into the GRASS directory hierarchy (e.g.
/usr/local/grass6/include). You need to use a -I switch to specify the
location, e.g.

  gcc -c -I /usr/local/grass6/include main.c

GRASS is quite a complex package, and may be quite hard to use if you
are new to C programming.

--
Glynn Clements <glynn@gclements.plus.com>

Yes but now I have another problem !

This works fine :

gcc -c -I /usr/lib/grass/include main.c

But :

$ gcc -o prog main.o
main.o: In function main': main.c:(.text+0x26): undefined reference to G_gisinit’
collect2: ld returned 1 exit status

OR

$ gcc -I /usr/lib/grass/include -o prog main.o
main.o: In function main': main.c:(.text+0x26): undefined reference to G_gisinit’
collect2: ld returned 1 exit status

is no good… :-S

---------- Forwarded message ----------
From: Glynn Clements <glynn@gclements.plus.com>
Date: 23/03/2006 13:48
Subject: Re: [GRASSLIST:332] gis.h problem
To: Ana Soares <tiobrothercamarada@gmail.com>
Cc: grasslist@baylor.edu

Ana Soares wrote:

I have GRASS 6 installed, but I can’t seem do have GIS library

$ gcc main.c
main.c:8:17: error: gis.h: No such file or directory

Why does this happen?
What must I do ?

GRASS doesn’t install headers into the system header directories (e.g.
/usr/include), but into the GRASS directory hierarchy (e.g.
/usr/local/grass6/include). You need to use a -I switch to specify the
location, e.g.

gcc -c -I /usr/local/grass6/include main.c

GRASS is quite a complex package, and may be quite hard to use if you
are new to C programming.


Glynn Clements < glynn@gclements.plus.com>

Ana Soares wrote:

Yes but now I have another problem !

This works fine :

gcc -c -I /usr/lib/grass/include main.c

But :

$ gcc -o prog main.o
main.o: In function `main':
main.c:(.text+0x26): undefined reference to `G_gisinit'
collect2: ld returned 1 exit status

You need to link against the GRASS libraries, e.g.

  gcc ... -L/usr/local/grass6/lib -lgrass_gis

--
Glynn Clements <glynn@gclements.plus.com>

hallo,
try to look at r.example and v.example modules. IMHO this is the best
way, how to start

jachym

On Thu, Mar 23, 2006 at 11:39:36AM +0000, Ana Soares wrote:

Hei,

I have GRASS 6 installed, but I can't seem do have GIS library

$ gcc main.c
main.c:8:17: error: gis.h: No such file or directory

Why does this happen?
What must I do ?

Thanks

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz