Reputation: 289
crypt function for data encryption (using eclipse IDE) is giving me errors in this line of my C code
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 test.c -lcrypt
Man page for script tells us to link with -lcrypt.
But how can I resolve this issue in eclipse IDE/ how can i link -lcrypt in eclipse ?
Upvotes: 2
Views: 1589
Reputation: 254711
Add the library to the linker options in the project settings. In my version of Eclipse, that's:
Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> Linker -> Libraries
Add crypt
to the "Libraries (-l)" panel.
Upvotes: 4