This topic needs a title

Newsgroups: info.grass.programmer
Path: zorro.cecer.army.mil!shapiro
From: shapiro@zorro.cecer.army.mil (Michael Shapiro)
Subject: Re: 4.1 compile failure: i.ortho.photo
Message-ID: <C6zIuF.18A@news.cecer.army.mil>
Sender: news@news.cecer.army.mil (Net.Noise owner)
Organization: US Army Corps of Engineers Construction Engineering Research Labs
References: <9305132028.AA05396@towhee.cor2.epa.gov>
Date: Thu, 13 May 1993 21:39:50 GMT
Lines: 64

In <9305132028.AA05396@towhee.cor2.epa.gov> greg@towhee.cor2.epa.gov (Greg Koerper) writes:

Anyone familiar with this problem (I'm compiling on a Sun SPARC):

rm -f OBJ.sun4/zoom_box.o
gcc -O2 -I../libes -I/files/data/hydro/data2/grass4.1/src/include -c zoom_box.c
zoom_box.c:29: warning: `zoom1' was declared `extern' and later `static'
zoom_box.c: In function `zoom1':
zoom_box.c:34: `cancel' undeclared (first use this function)
zoom_box.c:34: (Each undeclared identifier is reported only once
zoom_box.c:34: for each function it appears in.)
zoom_box.c: At top level:
zoom_box.c:90: warning: `zoom2' was declared `extern' and later `static'
zoom_box.c:193: `cancel' used prior to declaration
zoom_box.c:193: warning: `cancel' was declared `extern' and later `static'
make[1]: *** [OBJ.sun4/zoom_box.o] Error 1
make: *** [all] Error 1
GISGEN failure at STEP: src.alpha/imagery/i.ortho.photo

---------------
I'm about to take a look under the hood, but any clues would be greatly
appreciated. The headache occurs in the compilation of

src.alpha/imagery/i.ortho.photo/photo.2image dir

The problem is the way the staic routines are declared:

    sub()
    {
  int cancel(); /* this is the problem */
  .
  .
  .
    }
    static int cancel()
    {
    .
    .
    .
    }

The fix is to move the declaration of cancel() outside the sub() and declare
it to be static:

    static int cancel(); /* this is the fix */
    sub()
    {
  .
  .
  .
    }
    static int cancel()
    {
    .
    .
    .
    }

gcc catches this "type" mismatch, while SUN cc doesn't mind.
--
Michael Shapiro shapiro@zorro.cecer.army.mil
U.S. Army CERL (217) 373-7277
P.O. Box 9005
Champaign, Ill. 61826-9005