Error Compiling: Macro names must be identifiers (act_comm.c)

Posted by Nystix on Sun 03 Nov 2002 08:17 PM — 8 posts, 36,552 views.

#0
I finally got Cygwin to download, and compile - with so many mirrors and so few with everything it was giving me a headache, but now there appears to be some glitch in act_comm.c If I wasn't so fried I might have some idea how to fix this, but I'de appreciate any help that can be given.

$ make
make smaug
make[1]: Entering directory '/cygwindrive/h/smaug/dist/src'
gcc -c -0 -g3 -Wall -Wuninitialized -DSMAUG act_comm.c
act_comm.c:3326:9: macro names must be identifiers
make[1]: *** [act_comm.o] Error 1

It then leaves the directory.

What is this, and how can I fix it... any ideas?
Australia Forum Administrator #1
Can you post around line 3326 in that file? In mine, it seems much the same as the previous lines.

#2
int is_profane (char *what)
{
#ifndef 0
int ret;

ret = re_exec(what);
if (ret==1)
return(1);
#endif

Should #ifndef 0 be #ifndef WIN32? I think I changed that at some point in time due to some bug report on it...
#3
Alright, it makes it past that, now it errors on Build.c. The parse error is on this line:

if ( !can_mmodify( ch, victim ) )

Full code being:

/*
* save some more finger-leather for setting RIS stuff
*/
if ( !str_cmp( arg2, "r" ) )
{
if ( !IS_NPC( victim ) && get_trust( ch ) < LEVEL_LESSER )
{
send_to_char( "You can only modify a mobile's ris.\n\r", ch );
return;
}
if ( !can_mmodify( ch, victim ) )
return;
#4
This is my newest error, I'm really unsure of this one, I think it is the COMPLETE build.c though, I realized that my previous post made no sense, and noticed that a great deal of code was GONE. I have taken out the warnings, as they appear unimportant as they are all on the same lines anyway.

build.c:9165: parse error before ')' token
build.c:9165: parse error before ')' token
build.c:9165: parse error before '}' token
build.c:9169: request for member `next' in something not a structure or union
build.c: At top level:
build.c:9177: parse error before "tp"
build.c:9177: warning: type mismatch with previous implicit declaration
build.c:3047: warning: previous implicit declaration of `RelDestroy'
build.c:9177: warning: `RelDestroy' was previously implicitly declared to return
`int'
build.c: In function `RelDestroy':

make[1]: *** [build.o] Error 1
make[1]: Leaving directory `/cygdrive/h/smaug/dist/src'
make: *** [all] Error 2
Australia Forum Administrator #5
I'm a bit worried about what source you are using here. You said something about "so many mirrors", it is hard to fix problems that might be because you have incomplete source.

The file here on this site:

http://www.gammon.com.au/files/smaug/smaug1.4a_mxp.tgz

should compile - it is standard 1.4a SMAUG with stuff for MXP added. It compiles under Cygwin with some warnings and no errors.
#6
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/cygdrive/h/smaug/dist/src'
make: *** [all] Error 2

Administrator@VVWK2 /cygdrive/h/smaug/dist/src
$ make
make smaug
make[1]: Entering directory `/cygdrive/h/smaug/dist/src'
rm -f smaug
gcc -lcrypt -o smaug act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o build.o clans.o comm.o comments.o const.o db.o deity.o fight.o handler.o hashstr.o ibuild.o ident.o interp.o magic.o makeobjs.o mapout.o misc.o mpxset.o mud_comm.o mud_prog.o player.o polymorph.o requests.o reset.o save.o shops.o skills.o special.o tables.o track.o update.o grub.o stat_obj.o ban.o services.o planes.o imm_host.o colorize.o

/usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../../i686-pc-cygwin/bin/ld: cannot find -lcrypt

collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/cygdrive/h/smaug/dist/src'
make: *** [all] Error 2

Ugh.... I saw another post on this but it did not help. Can you shed any light please? You've been an AWSOME help so far. I'll check this again tomorrow.

Here is my makefile, currently.

CC = gcc
#PROF = -p
NOCRYPT =

# Uncomment the two lines below if compiling on a Solaris box
#SOLARIS_FLAG = -Dsun -DSYSV
#SOLARIS_LINK = -lnsl -lsocket

#Uncomment the line below if you are getting a line like:
#interp.c:757: warning: int format, time_t arg (arg 7)
#TIME = -DTIMEFORMAT

#Uncomment the line below if you are getting implicit decleration of re_exec
#REG = -DREGEX

#Uncomment the line below if you are getting undefined re_exec errors
NEED_REG = -lgnuregex

#Uncomment the line below if you are getting undefined crypt errors
NEED_CRYPT = -lcrypt

#DBUGFLG = -DREQUESTS

#Uncomment the line below if you want a performance increase though beware
#your core files may not be as much of a benefit if you do.
#OPT_FLAG = -finline-functions -funroll-loops -fdefer-pop -fstrength-reduce

C_FLAGS = $(OPT_FLAG) -O -g3 -Wall -Wuninitialized $(PROF) $(NOCRYPT) $(DBUGFLG) -DSMAUG $(SOLARIS_FLAG) $(TIME) $(REG)
L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_CRYPT)

#Uncomment the next three comments below if you want to use IMC
#USE_IMC = -DUSE_IMC

#IMC_OFILES = imc.o imc-mail.o imc-interp.o imc-util.o imc-config.o \
# imc-events.o imc-version.o imc-mercbase.o ice.o icec.o icec-mercbase.o

#IMC_CFILES = imc.c imc-mail.c imc-interp.c imc-util.c imc-config.c \
# imc-events.c imc-version.c imc-mercbase.c ice.c icec.c icec-mercbase.c

O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o \
build.o clans.o comm.o comments.o const.o db.o deity.o fight.o \
handler.o hashstr.o ibuild.o ident.o interp.o magic.o makeobjs.o \
mapout.o misc.o mpxset.o mud_comm.o mud_prog.o player.o polymorph.o \
requests.o reset.o save.o shops.o skills.o special.o tables.o \
track.o update.o grub.o stat_obj.o ban.o services.o planes.o \
imm_host.o $(IMC_OFILES) colorize.o

C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c boards.c \
build.c clans.c comm.c comments.c const.c db.c deity.c fight.c \
handler.c hashstr.c ibuild.c ident.c interp.c magic.c makeobjs.c \
mapout.c misc.c mpxset.c mud_comm.c mud_prog.c player.c polymorph.c \
requests.c reset.c save.c shops.c skills.c special.c tables.c \
track.c update.c grub.c stat_obj.c ban.c services.c planes.c \
imm_host.c $(IMC_CFILES) colorize.c slay.c

H_FILES = mud.h bet.h imc-config.h imc-mercbase.h imc-mercdefs.h imc.h \
ice.h icec.h icec-mercbase.h slay.h

all:
make smaug

smaug: $(O_FILES)
rm -f smaug
$(CC) $(L_FLAGS) $(USE_IMC) -o smaug $(O_FILES)
chmod g+w smaug
chmod a+x smaug
chmod g+w $(O_FILES)

.c.o: mud.h
$(CC) -c $(C_FLAGS) $(USE_IMC) $<

clean:
rm -f *.o smaug *~
Australia Forum Administrator #7
I think the crypt library is something you can download from the Cygwin site as a separate thing. Run the setup program again and check you are getting crypt.