Error #1 Compiling Grass5.0beta

egm2 at jps.net egm2 at jps.net
Sat Jul 31 02:34:42 EDT 1999


(Sorry if this is a repost)

Compiling grass on GNU/Linux, Debian - potato:

Received this error:

gcc -g -O2  -I/usr/local/src/grass5.0beta/src/mapdev/Vlib
-I/usr/local/src/grass5.0beta/src/mapdev/diglib
-I/usr/local/src/grass5.0beta/src/include  -c r_dlg_head.c
r_dlg_head.c:186: macro `strchr' used without args
make[1]: *** [OBJ.i686-pc-linux-gnu/r_dlg_head.o] Error 1
make[1]: Leaving directory
`/usr/local/src/grass5.0beta/src/mapdev/v.in.dlg'
GISGEN failure at STEP: src/mapdev/v.in.dlg
make: *** [do-install] Error 1

The offending code redefines ANSI C functions/macros pow() and strchr():

>From r_dlg_head.c
<SNIP>
    184 static int _get_dtype(char *buf, double *doub)
    185 {
    186         char *strchr() ;
    187         double raise ;
    188         double pow() ;
    189         int pwr ;
    190 
    191         *doub = 0.0 ;
    192         raise = 10.0 ;
    193         pwr = 0 ;
    194         sscanf(buf,"%lf", doub) ;
    195         if (*doub != 0.0)
    196         {
    197             /* sscanf(strchr(buf,'D')+1,"%d", &pwr) ; */
    198             char *p;
    199             if ((p = G_index (buf, 'D')) != NULL)
    200                 sscanf(p+1, "%d", &pwr);
    201 
    202         }
    203         if (pwr)
    204         {
    205                 *doub = *doub * pow(raise, (double)pwr) ;
    206         }
    207 
    208         return 0;
    209 }

</SNIP>

This problem is fixed (for compilation at least) by commenting out
lines 186 and 188.

-- 

Eric G. Miller
Powered by the POTATO (http://www.debian.org)!



More information about the grass-user mailing list