[GRASS-dev] unknown reference to G__gisinit

Markus Neteler neteler at osgeo.org
Sat May 5 05:07:55 EDT 2012


On Fri, May 4, 2012 at 1:37 PM, Xavier Rubio <xrubio at gmail.com> wrote:
>
> Hi, I'm starting to develop some code using Grass following the programmer's
> manual:
> http://grass.osgeo.org/programming6/gislib.html
>
> but I'm unable to link an example with just the library initialization,
> receiving this error:
>
> gcc -o main.o -c -I/usr/lib/grass64/include main.cxx
> gcc -o test main.o -L/usr/lib/grass64/lib -lgrass_gis
> main.o: In function `main':
> main.cxx:(.text+0x3b): undefined reference to `G__gisinit(char const*, char
> const*)'

It is highly recommended to use a GRASS style Makefile. This will likely
solve the problem. For a simple one, see
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/general/g.ask/Makefile

for raster or vector processing, respectively
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/raster/r.example/
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/vector/v.example/

Markus


More information about the grass-dev mailing list