Problems in compiling S.MENU

Marco Valagussa marco at duffy.crcc.it
Mon Apr 27 04:52:32 EDT 1998


On 24 Apr, Clifton Wood wrote:
> When compiling the latest Grass (4.2.1 v14) I get the following when
> trying
> to compile s.menu:
> 
> 
> #################################################################
> /export/home/benjy/cals/cliff/grass/src421/src/sites/s.menu/Lib
>   make -f OBJ.solaris2.6/make.rules 
> 
> rm -f OBJ.solaris2.6/menu_hndlr.o
> gcc -O2 -I/export/home/cbwood/emacs/include
> -L/export/home/cbwood/emacs/lib -DBSD_COMP -I../Include
> -I/export/home/benjy/cals/cliff/grass/src421/src/include  -c
> menu_hndlr.c
> menu_hndlr.c: In function `menu_handler':
> menu_hndlr.c:16: subscripted value is neither array nor pointer
> menu_hndlr.c:18: subscripted value is neither array nor pointer
> menu_hndlr.c:20: subscripted value is neither array nor pointer
> menu_hndlr.c:38: subscripted value is neither array nor pointer
> menu_hndlr.c:39: subscripted value is neither array nor pointer
> menu_hndlr.c:45: subscripted value is neither array nor pointer
> menu_hndlr.c:46: subscripted value is neither array nor pointer
> *** Error code 1
> make: Fatal error: Command failed for target
> `OBJ.solaris2.6/menu_hndlr.o'
> 
> -----------------------------------------------------------------
> 
> The problem in question stems from the definition of the variable
> menu (of type MENU) which is defined as the following (from 
> src/sites/s.menu/Include/menu.h):
> 
> typedef struct {char *text; int choice;} MENU[];
> 
> Now for as long as I've used GCC, I've *never* seen such a definition 
> work. How can I fix this? Until then, I'm removing s.menu from my set of
> commands and forging ahead (we just got new HDs so I'll be able to leave
> the
> Grass source tree online) and compile it later after I get some
> responses.
> Thanks in advance.

Are you using linux & ncurses (isn't it)?
If so, the problem is not the typedef instruction in
src/sites/s.menu/include/menu.h (also if it is unusual)
but the confilct with the typedef for MENU in
/usr/include/ncurses/menu.h.

Solutions:
1 - Change the local name for include file menu.h (to Menu.h) and every
    file where it is used.
2 - Specify the local directory with include file menu.h to GCC.
    To do so you have to apply the follwing patch on file
    src/CMD/generic/make.mid and add the directive
    	 INCLUDE_CURSES = -I/usr/include/ncurses
    to your file src/CMD/head/linux
I hope this is useful for you - ciao, marco.

------------------------------------------------------------------------------
Valagussa Marco      CRCC s.r.l, via Passerini 2,       20052 Monza (MI) ITALY
                     Tel. +39.39.387998                 FAX  +39.39.382115
                     e-mail: marco at crcc.it
------------------------------------------------------------------------------
-------------- next part --------------
26c26,27
< CFLAGS      =  $(COMPILE_FLAGS) $(EXTRA_CFLAGS) -I$(INCLUDE_DIR) $(USE_TERMIO)
---
> CFLAGS      =  $(COMPILE_FLAGS) $(EXTRA_CFLAGS) -I$(INCLUDE_DIR) \
> 		$(INCLUDE_CURSES)  $(USE_TERMIO)


More information about the grass-user mailing list