[GRASS5] grass and external apps

Glynn Clements glynn at gclements.plus.com
Tue May 3 17:17:57 EDT 2005


Jachym Cepicky wrote:

> how to write some application, which should be able to access GRASS maps?
> I wanted to use GRASS  G_* functions..
> 
> I included gis.h and gisdefs.h, like
> 
> #include /usr/local/grass-6.1.cvs/include/gis.h 
> #include /usr/local/grass-6.1.cvs/include/gisdefs.h

In the source code, use:

	#include <gis.h>

When compiling the code, use the compiler switch:

	-I/usr/local/grass-6.1.cvs/include

This is necessary so that GRASS header files can include other GRASS
header files.

> but, by the compilation, I get
> [....]
> readgrass.c:50: undefined reference to `G_allocate_raster_buf'
> readgrass.o(.text+0x88):readgrass.c:67: undefined reference to `G_get_c_raster_row' 
> readgrass.o(.text+0x1dd):readgrass.c:139: undefined reference to `G_free'
> readgrass.o(.text+0x1ea):readgrass.c:140: undefined reference to `G_close_cell'
> [....]
> 
> What to do?

You need to add some linking switches, e.g.:

	-L/usr/local/grass-6.1.cvs/lib -lgrass_gis

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




More information about the grass-dev mailing list