user2723949
user2723949

Reputation: 289

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("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

Answers (1)

Mike Seymour
Mike Seymour

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

Related Questions