简体   繁体   English

Eclipse IDE中对“ crypt”的未定义引用

[英]undefined reference to `crypt' in Eclipse IDE



crypt function for data encryption (using eclipse IDE) is giving me errors in this line of my C code 用于数据加密的crypt函数(使用eclipse IDE)在我的C代码行中给我错误

crypt("password", pwd->sp_pwdp);

It says that it is undefined. 它说它是未定义的。 I got the same error when I tried the same code in ubuntu with gcc ( gcc test.c ) , I guess is linker error because it worked fine in ubuntu when I tried this 当我使用gcc( gcc test.c )在ubuntu中尝试相同的代码时,我遇到了相同的错误,我猜想是链接器错误,因为当我尝试此操作时,它在ubuntu中可以正常工作

gcc test.c -lcrypt

Man page for script tells us to link with -lcrypt. 脚本的手册页告诉我们与-lcrypt链接。
But how can I resolve this issue in eclipse IDE/ how can i link -lcrypt in eclipse ? 但是,如何在Eclipse IDE中解决此问题/如何在Eclipse中链接-lcrypt?

Add the library to the linker options in the project settings. 将库添加到项目设置中的链接器选项。 In my version of Eclipse, that's: 在我的Eclipse版本中,这是:

Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> Linker -> Libraries 项目->属性-> C / C ++构建->设置->工具设置->链接器->库

Add crypt to the "Libraries (-l)" panel. 将“ crypt ”添加到“库(-l)”面板中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM