I have been trying to make my crack.c
code work on my Windows 10 laptop. The code runs on CS50 IDE (online IDE) without any errors. However, when I try to compile the code on my laptop using mingw32 on command line, the compiler is giving me an error:
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot
find -lcrypt collect2.exe: error: ld returned 1 exit status
The code uses crypt()
from the Linux C library. I tried to link the compiler to this by -lcrypt
but apparently it does not exist.
How to solve this issue?
MinGW doesn't generally come with libcrypt. You'll have to either find a Windows version of the static library (I don't know of one), or alternatively, you can include the source code for crypt(3)
in your project.
This version of crypt.c has worked for me in the past. (Code is in the public domain). It's a fairly old version, but it suffices.
In the event the link rots away, a simple web search should yield several examples, as the source is widely available, with varying levels of licensing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.