Undefined reference to _crypt

Posted by Nystix on Thu 07 Nov 2002 09:43 PM — 3 posts, 15,165 views.

#0
Here is my error, I fixed the other _re_exec. Oddly enough, the code showed that everything was right in wordpad, but when I opened it up in a different program there were a couple changes... weird.

$ make
make smaug
make[1]: Entering directory `/cygdrive/h/smaug/dist/src'
gcc -c -O -g3 -Wall -Wuninitialized -DNOCRYPT -DSMAUG act_comm.c
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
act_info.o: In function `do_password':
/cygdrive/h/smaug/dist/src/act_info.c:3474: undefined reference to `_crypt'
act_wiz.o: In function `do_form_password':
/cygdrive/h/smaug/dist/src/act_wiz.c:5441: undefined reference to `_crypt'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make[1]: Leaving directory `/cygdrive/h/smaug/dist/src'
make: *** [all] Error 2

Here is the pertinent section of my makefile:

NOCRYPT = -DNOCRYPT

#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 = -lregex

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


If anyone could shed some light, I would be eternally grateful.
#1
NOTE TO SELF: Do not attempt to make while open makefile and necessary files are open. *slap self* Sometimes I wonder... That was my problem, I had makefile open in another program yet.
Australia Forum Administrator #2
Have you tried doing a clean make?

That is, type:

rm *.o

And then "make"

That gets rid of all object files and forces everything to be recompiled. If you don't do that, but you change the makefile, the changes might not have much effect.