[GRASSLIST:1003] Re: compile on command line w/o gmake

Glynn Clements glynn.clements at virgin.net
Fri Aug 22 21:26:00 EDT 2003


stef wrote:

> Thank you for your assistance with the compiling
> issues.
> 
> I have one last question...maybe..hopefully..  
> 
> Is it possible to run 
> #gcc gisTest.c 
> 
> on the command line?  
> 
> I keep getting error statements saying:
>  "no header file for the gis.h".. 

Assuming that GRASS is installed under /usr/local:

gcc -I/usr/local/grass5/include -L/usr/local/grass5/lib gisTest.c -lgis -ldatetime -lz

Note that only libgis and libdatetime (and their headers) are
installed. If you want to use other GRASS libraries (e.g. vector or
display libraries), you will have to reference a compiled source tree,
e.g.:

gcc -I/usr/src/grass5/src/include -L/usr/src/grass5/src/libes/LIB.<arch> gisTest.c -lvect -ldig2 -lgis -ldatetime -lz

(where <arch> is the architecture name, e.g. i686-pc-linux-gnu).

Also, you might want to use some of the make variables from
src/CMD/generic/make.mid and/or src/CMD/head/head.<arch>.

Usually, it's a lot easier to add your code to the GRASS source tree
and use gmake5. That way, you can just use the make variables that get
defined automatically instead of having to figure out the necessary
compiler/linker switches yourself.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list