[GRASSLIST:2185] new module compilation problems

chiara.sboarina at katamail.com chiara.sboarina at katamail.com
Mon Jan 12 04:04:00 EST 2004


Hi,
I'm trying to transform a program, that calculates forest carbon fluxes, 
in a GRASS module. I have rewritten the main code file and modified some 
other code files but when I try to compile it I get some errors. I can't 
understand how to correct errors because many of them are in lines with 
GRASS libraries. I report the compiler error lines and a piece of the 
program.

main.c:30: parse error before `{'
main.c:27: parm types given both in parmlist and separately
main.c:154: `argv' undeclared (first use in this function)
main.c:154: (Each undeclared identifier is reported only once
main.c:154: for each function it appears in.)
main.c:157: warning: assignment from incompatible pointer type
main.c:158: dereferencing pointer to incomplete type


#include "gis.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <string.h>
#include <time.h>
#include "bgc_struct.h"       /* data structures for bgc() */
#include "pointbgc_func.h"    /* function prototypes for point driver */
#include "bgc_constants.h"

#define DEBUG

struct Cell_head window;		/*line 27*/

int main(int argc, char *argv[])
{

...
	/*initialize access to database and create temporary files*/
	G_gisinit (argv[0]);		/*line 154*/

	/*Set description*/
	module = G_define_module();	/*line 157*/
	module->description =		/*line 158*/
	 "Calculate the amount of C stocked by forest or vegetated zones";


Perhaps I have written a bad Gmakefile I don't know so I report also it.

------------------------------------------------------------------------
PGM =r.biomebgc

OBJ= main.o bgc.o annual_rates.o atm_pres.o baresoil_evap.o canopy_et.o\
     check_balance.o daily_allocation.o daymet.o dayphen.o decomp.o\
     epc_init.o firstday.o growth_resp.o maint_resp.o\
     make_zero_flux_struct.o metarr_init.o mortality.o nleaching.o\
     outflow.o phenology.o photosynthesis.o prcp_route.o 
precision_control.o\
     prephenology.o presim_state_init.o radtrans.o smooth.o snowmelt.o\
     soilpsi.o state_update.o summary.o zero_srcsnk.o 
	
LIBES= $(SRC)/raster/r.biomebgc/bgclib411.a

$(BIN_CMD)/$(PGM): $(OBJ) $(GISLIB) $(LIBES)
	$(CC) $(LDFLAGS) -o $@ $(OBJ) $(GISLIB) $(MATHLIB) $(XDRLIB) $(LIBES)

main.o: bgc_struct.h pointbgc_func.h bgc_constants.h
bgc.o: bgc_struct.h bgc_func.h bgc_constants.h 
annual_rates.o: bgc_struct.h bgc_func.h bgc_constants.h
atm_pres.o: bgc_struct.h bgc_func.h bgc_constants.h
baresoil_evap.o: bgc_struct.h bgc_func.h bgc_constants.h
canopy_et.o: bgc_struct.h bgc_func.h bgc_constants.h
check_balance.o: bgc_struct.h bgc_func.h bgc_constants.h
daily_allocation.o: bgc_struct.h bgc_func.h bgc_constants.h
daymet.o: bgc_struct.h bgc_func.h bgc_constants.h
dayphen.o: bgc_struct.h bgc_func.h bgc_constants.h
decomp.o: bgc_struct.h bgc_func.h bgc_constants.h
firstday.o: bgc_struct.h bgc_func.h bgc_constants.h
growth_resp.o: bgc_struct.h bgc_func.h bgc_constants.h
maint_resp.o: bgc_struct.h bgc_func.h bgc_constants.h
make_zero_flux_struct.o: bgc_struct.h bgc_func.h bgc_constants.h
mortality.o: bgc_struct.h bgc_func.h bgc_constants.h
nleaching.o: bgc_struct.h bgc_func.h bgc_constants.h
outflow.o: bgc_struct.h bgc_func.h bgc_constants.h
phenology.o: bgc_struct.h bgc_func.h bgc_constants.h
photosynthesis.o: bgc_struct.h bgc_func.h bgc_constants.h
prcp_route.o: bgc_struct.h bgc_func.h bgc_constants.h
precision_control.o: bgc_struct.h bgc_func.h bgc_constants.h
prephenology.o: bgc_struct.h bgc_func.h bgc_constants.h
radtrans.o: bgc_struct.h bgc_func.h bgc_constants.h
snowmelt.o: bgc_struct.h bgc_func.h bgc_constants.h
soilpsi.o: bgc_struct.h bgc_func.h bgc_constants.h
state_update.o: bgc_struct.h bgc_func.h bgc_constants.h
summary.o: bgc_struct.h bgc_func.h bgc_constants.h
zero_srcsnk.o: bgc_struct.h bgc_func.h bgc_constants.h
epc_init.o: bgc_struct.h pointbgc_func.h
metarr_init.o: bgc_struct.h bgc_constants.h pointbgc_func.h misc_func.h
presim_state_init.o: bgc_struct.h pointbgc_func.h
smooth.o: misc_func.h

$(GISLIB): #
------------------------------------------------------------------------
---

Can anybody help me?
Thanks
Chiara


P.S.: I've forgotten to tell I'm using GRASS5pre2 on a linux machine with 
Red Hat Linux 6.2


============================
Ing. Chiara Sboarina
Centro di Ecologia Alpina
Viote del Monte Bondone
38040 Sardagna (TN)
Italia
============================




More information about the grass-user mailing list