I’m using GCC 4.6.0 (on an otherwise unidentified platform).
I am using the crypt() function to encrypt a password.
I have never used that function before so I checked out the main page:
man 3 crypt
And it says to include the unistd.h header.
However, when I did that, I got an implicit warning for the crypt function.
warning: implicit declaration of function ‘crypt’ [-Wimplicit-function-declaration]
I did a bit of searching and I found that you have to include the crypt.h. However, how come it doesn’t say that in the man page?
It also says
#define _XOPEN_SOURCE(before includingunistd.h) in my man page. So you should probably add it to expose the declaration ofcrypt.EDIT
I just tried it. Including
unistd.hand#define _XOPEN_SOURCEbefore it does the trick. Including it alone isn’t enough.Using
Looking into
unistd.h: