swr 2.0 compile cygwin

Posted by Ghsthntr on Tue 27 Dec 2005 06:18 PM — 12 posts, 52,675 views.

USA #0
ok im having a bit of trouble. I edited the makefile to be able to use cygwin. Im running off a winxp notebook. i keep getting this:

$ make
make -s swr
Compiling o/act_comm.o....
Compiling o/act_info.o....
act_info.c: In function `void do_password(CHAR_DATA*, char*)':
act_info.c:2551: error: `crypt' undeclared (first use this function)
act_info.c:2551: error: (Each undeclared identifier is reported only once for ea
ch function it appears in.)
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2

:Please help
USA #1
There should be some flag in the Makefile where you uncomment it to disable crypt.
USA #2
well i check the makefile and made the change's im still getting the:

$ make
make -s swr
Compiling o/act_comm.o....
Compiling o/act_info.o....
act_info.c: In function `void do_password(CHAR_DATA*, char*)':
act_info.c:2551: error: `crypt' undeclared (first use this function)
act_info.c:2551: error: (Each undeclared identifier is reported only once for ea
ch function it appears in.)
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2

my makefile is:

CC = g++
#PROF = -p
NOCRYPT =

# -E Preprocess only; do not compile, assemble or link
# -S Compile only; do not assemble or link
# -c Compile and assemble, but do not link
# -x Specify language of input files c++ or c
EXTRAFLG =

#Uncomment to compile in Cygwin
CYGWIN = -DCYGWIN

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

#Uncomment the line below if you are getting warnings about undefined math functions
#NEED_MATH = -lm

W_FLAGS = -Wall -pedantic -Werror -Wformat-security -Wshadow -Wpointer-arith -Wcast-align -Wredundant-decls

C_FLAGS = -g3 $(W_FLAGS) $(PROF) $(NOCRYPT) $(DBUGFLG) $(EXTRAFLG)
L_FLAGS = $(PROF) $(NEED_CRYPT) $(NEED_MATH) -lz

#Intermud-3 - Comment out to disable I3 support in your code
#I3 = 1

#IMC2 - Comment out to disable IMC2 support
IMC = 1


C_FILES = $(wildcard *.c)

ifdef I3
C_FLAGS := $(C_FLAGS) -DI3 -DI3SMAUG
endif

ifdef IMC
C_FLAGS := $(C_FLAGS) -DIMC -DIMCSMAUG
endif

O_FILES := $(patsubst %.c,o/%.o,$(C_FILES))

H_FILES = $(wildcard *.h)

all:
$(MAKE) -s swr

ifdef CYGWIN
swr: $(O_FILES)
rm -f swr.exe
$(CC) -o swr.exe $(O_FILES) $(L_FLAGS)
echo "Done compiling mud.";
chmod g+w swr.exe
chmod a+x swr.exe
chmod g+w $(O_FILES)
#mv swr.exe ../bin/swr
else
swr: $(O_FILES)
rm -f swr
$(CC) -o swr $(O_FILES) $(L_FLAGS)
echo "Done compiling mud.";
chmod g+w swr
chmod g+w $(O_FILES)
#mv swr ../bin/swr
endif

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

clean:
rm -f $(O_FILES) ./swr ./swr.exe

o/%.o: %.c
echo " Compiling $@....";
$(CC) -c $(C_FLAGS) $< -o $@
USA #3
This line:
#Uncomment the line below if you are getting undefined crypt errors
#NEED_CRYPT = -lcrypt

Remove the # in the second line.
USA #4
ok i removed the # and im still getting the same error.
USA #5
You shouldn't be. Try a make clean. Are you using SWRFUSS? If not, I suggest you should.
USA #6
Quote:
act_info.c:2551: error: `crypt' undeclared (first use this function)


This means act_info.c has not seen a definition for what "crypt" means. Any file which produces this error needs:


#include <crypt.h>


at the top with the other includes when using Cygwin. This gets you the declaration for the crypt function.

Secondly you need to remove the # from in front of:
#NEED_CRYPT = -lcrypt


That will allow the compiler to link the crypt library once you're done. This requires that you have the crypt library package installed from Cygwin.
USA #7
ok thanks that helped i got a clean make.
#8
I get the same Error, even after uncommenting the Cygwin and Crypt lines. Here is my Makefile. I also don't have crypt.h anywhere on my computer. It'd be great to know where I can get it, and where it needs to be placed.


CC = g++
#PROF = -p
NOCRYPT =

# -E Preprocess only; do not compile, assemble or link
# -S Compile only; do not assemble or link
# -c Compile and assemble, but do not link
# -x Specify language of input files c++ or c
EXTRAFLG =

#Uncomment to compile in Cygwin
CYGWIN = -DCYGWIN

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

#Uncomment the line below if you are getting warnings about undefined math functions
#NEED_MATH = -lm

W_FLAGS = -Wall -pedantic -Werror -Wformat-security -Wshadow -Wpointer-arith -Wcast-align -Wredundant-decls

C_FLAGS = -g3 $(W_FLAGS) $(PROF) $(NOCRYPT) $(DBUGFLG) $(EXTRAFLG)
L_FLAGS = $(PROF) $(NEED_CRYPT) $(NEED_MATH) -lz

#Intermud-3 - Comment out to disable I3 support in your code
#I3 = 1

#IMC2 - Comment out to disable IMC2 support
IMC = 1


C_FILES = $(wildcard *.c)

ifdef I3
C_FLAGS := $(C_FLAGS) -DI3 -DI3SMAUG
endif

ifdef IMC
C_FLAGS := $(C_FLAGS) -DIMC -DIMCSMAUG
endif

O_FILES := $(patsubst %.c,o/%.o,$(C_FILES))

H_FILES = $(wildcard *.h)

all:
$(MAKE) -s swr

ifdef CYGWIN
swr: $(O_FILES)
rm -f swr.exe
$(CC) -o swr.exe $(O_FILES) $(L_FLAGS)
echo "Done compiling mud.";
chmod g+w swr.exe
chmod a+x swr.exe
chmod g+w $(O_FILES)
#mv swr.exe ../bin/swr
else
swr: $(O_FILES)
rm -f swr
$(CC) -o swr $(O_FILES) $(L_FLAGS)
echo "Done compiling mud.";
chmod g+w swr
chmod g+w $(O_FILES)
#mv swr ../bin/swr
endif

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

clean:
rm -f $(O_FILES) ./swr ./swr.exe

o/%.o: %.c
echo " Compiling $@....";
$(CC) -c $(C_FLAGS) $< -o $@
#9
Nevermind, I had to get the right Makefil, I had an old version of the server, also, and was using two folders, haha. Sorry for the false alarm.
#10
Ok that got ride of some of it but not i get a new message...

act_move.c: In function 'ROOM_INDEX_DATA* generate_exit<ROOM_INDEX_DATA*, EXIT_DATA**>':
act_move.c:604: erro: ISO C++ forbids cast to non-reference type used as lvalue

make[1]: *** [act_move.o] Error 1
make[1]: Leaving directory '/cygdrive/c/Phobos/swrip200/src'
make: *** [all] Error 2

thank you for helping with the crypt and would be greatfull if you can help with the message here also
USA #11
Please copy-paste error messages, not just retyping them.

And once again, use search.
http://www.gammon.com.au/forum/bbshowpost.php?id=7445