Hi, thanks for your answers. Markus, I compared the compilation of "r.example" with my own system and realized that the only difference was the compiler (gcc or g++). Compiling my code with gcc worked, so the problem is the fact that I was developing C++ code to call a C function (the binary symbols are different, so it explains the errors).<br>
Fix this problem was rather easy; I specified the compiler that the gis.h include is C code:<br><br>extern "C" <br>{<br>#include <grass/gis.h><br>}<br><br>and it worked, just in case other people finds the same problem.<br>
<br>Thanks!<br><br>Xavi<br><br><div class="gmail_quote">2012/5/5 Markus Neteler <span dir="ltr"><<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, May 4, 2012 at 1:37 PM, Xavier Rubio <<a href="mailto:xrubio@gmail.com">xrubio@gmail.com</a>> wrote:<br>
><br>
> Hi, I'm starting to develop some code using Grass following the programmer's<br>
> manual:<br>
> <a href="http://grass.osgeo.org/programming6/gislib.html" target="_blank">http://grass.osgeo.org/programming6/gislib.html</a><br>
><br>
> but I'm unable to link an example with just the library initialization,<br>
> receiving this error:<br>
><br>
> gcc -o main.o -c -I/usr/lib/grass64/include main.cxx<br>
> gcc -o test main.o -L/usr/lib/grass64/lib -lgrass_gis<br>
> main.o: In function `main':<br>
> main.cxx:(.text+0x3b): undefined reference to `G__gisinit(char const*, char<br>
> const*)'<br>
<br>
</div>It is highly recommended to use a GRASS style Makefile. This will likely<br>
solve the problem. For a simple one, see<br>
<a href="http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/general/g.ask/Makefile" target="_blank">http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/general/g.ask/Makefile</a><br>
<br>
for raster or vector processing, respectively<br>
<a href="http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/raster/r.example/" target="_blank">http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/raster/r.example/</a><br>
<a href="http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/vector/v.example/" target="_blank">http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/vector/v.example/</a><br>
<span class="HOEnZb"><font color="#888888"><br>
Markus<br>
</font></span></blockquote></div><br>