These are the first lines of r.example main.c (that I renamed in main.cc)<br><br>#include <stdio.h> <br>#include <stdlib.h><br>#include <string.h><br><br>extern "C"<br>{<br> #include <grass/gis.h><br> #include <grass/glocale.h><br>} <br><br>extern CELL f_c(CELL);<br>extern FCELL f_f(FCELL);<br>extern DCELL f_d(DCELL);<br> ....<br><br>And this is its makefile I edit as you told me to do:<br><br>MODULE_TOPDIR = ../..<br>PGM = r.example<br><br>LIBES = $(GISLIB)<br>DEPENDENCIES = $(GISDEP)<br> <br>MOD_OBJS := $(subst .cc,.o,$(wildcard *.cc)) <br> <br>include $(MODULE_TOPDIR)/include/Make/Module.make<br> <br>default: cmd<br> <br>Then I typed make and here the message:<br><br>make: *** No rule to make target `OBJ.i686-pc-linux-gnu/main.o', needed by
`/home/roberto/grass/grass-6.2.3/dist.i686-pc-linux-gnu/bin/r.example'. Stop.<br>roberto@roberto-laptop:~/grass/grass-6.2.3/raster/r.example$ <br><br><br><b><i>Glynn Clements <glynn@gclements.plus.com></i></b> ha scritto:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <br>roberto caselli wrote:<br><br>> Thank you very much! How can I edit the raster example to have a c++ source code (.cc extension)?<br>> I should edit something in the makefile, but I don't how to do. Someone could help me?<br><br>Add the following line before including the *.make files (e.g. Module.make):<br><br> MOD_OBJS := $(subst .cc,.o,$(wildcard *.cc))<br><br>By default, MOD_OBJS is determined based upon the .c files in the<br>directory.<br><br>Rules.make already includes pattern rules for compiling .cc and .cpp<br>files.<br><br>Note that the GRASS headers don't make allowances for use in C++ code,<br>so you need to
use e.g.:<br><br> extern "C" {<br> #include <grass gis.h=""><br> }<br><br>At some point, we should probably change Rules.make to automatically<br>deal with C++ files (.cc and .cpp extensions; maybe .cxx as well).<br><br>-- <br>Glynn Clements <glynn@gclements.plus.com><br></glynn@gclements.plus.com></grass></blockquote><br><p> 
<hr size=1><font face="Arial" size="2">Scopri il <a href="http://us.rd.yahoo.com/mail/it/taglines/yahoo/ymail/SIG=11djrg460/**http%3A%2F%2Fwww.ymailblogit.com%2Fblog%2F"> Blog di Yahoo! Mail</a>: trucchi, novità, consigli... e la tua opinione!</font>