mingw32编译器在-lcrypt中产生错误

时间:2021-03-30 09:09:24

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代码适用于我的Windows 10笔记本电脑。代码在CS50 IDE(在线IDE)上运行,没有任何错误。但是,当我试图在命令行上使用mingw32在我的笔记本上编译代码时,编译器给了我一个错误:

 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.

代码使用来自Linux C库的crypt()。我试图通过-lcrypt将编译器链接到这个文件,但显然它不存在。

How to solve this issue?

如何解决这个问题?

1 个解决方案

#1


0  

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.

MinGW一般不支持libcrypt。您必须找到静态库的Windows版本(我不知道),或者您可以在项目中包含crypt(3)的源代码。

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.

这个版本的墓穴。c以前为我工作过。(代码在公共领域)。这是一个相当古老的版本,但已经足够了。

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.

如果链接消失了,一个简单的web搜索应该会有几个例子,因为源是广泛可用的,并且有不同程度的许可。

#1


0  

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.

MinGW一般不支持libcrypt。您必须找到静态库的Windows版本(我不知道),或者您可以在项目中包含crypt(3)的源代码。

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.

这个版本的墓穴。c以前为我工作过。(代码在公共领域)。这是一个相当古老的版本,但已经足够了。

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.

如果链接消失了,一个简单的web搜索应该会有几个例子,因为源是广泛可用的,并且有不同程度的许可。