Je souhaite utiliser la fonction crypt_r
sous Mac OS X 10.8.2
#define _GNU_SOURCE #include
produit
crypt.h: No such file or directory
Où puis-je obtenir le fichier crypt.h? Ou est-ce que je l’incline mal?
Question modifiée – exemple concret
#include #include int main(){ struct crypt_data * data = (struct crypt_data *) malloc(sizeof(struct crypt_data)); char * testhash; testhash = crypt_r("ssortingng", "sa", data); free(data); return 0; }
produit
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
Edit: crypt_r()
n’est pas disponible sous OS X.
Réponse originale:
Le contenu de
sous OS X est géré par
. Donc, au lieu de
#define _GNU_SOURCE #include
écrivez simplement
#include
afin d’accéder à la fonction crypt()
.