我想crypt_r
在 Mac OS X 10.8.2 上使用该功能
#define _GNU_SOURCE
#include <crypt.h>
生产
crypt.h: No such file or directory
我可以从哪里获得 crypt.h 文件?还是我把它包括错了?
已编辑的问题 - 具体示例
#include <unistd.h>
#include <stdlib.h>
int main(){
struct crypt_data * data = (struct crypt_data *) malloc(sizeof(struct crypt_data));
char * testhash;
testhash = crypt_r("string", "sa", data);
free(data);
return 0;
}
生产
gcc test.c -Wall
test.c: In function ‘main’:
test.c:5: error: invalid application of ‘sizeof’ to incomplete type ‘struct crypt_data’
test.c:7: warning: implicit declaration of function ‘crypt_r’
test.c:7: warning: assignment makes pointer from integer without a cast