kiruthika kiruthika - 1 year ago 150
C Question

crypt function and link error "undefined reference to 'crypt'"

I have used the crypt function in c to encrypt the given string.
I have written the following code,


int main()

But the above code threw an error ,"undefined reference to `crypt'".
What is the problem in the above code.

Thanks in advance.

caf caf
Answer Source

If you want to use the crypt() function, you need to link to the crypt library. Add -lcrypt to your compile command (as the man page tells you to!).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download