title: Using crypt_r on OS X
body: <p>I want to use the <code>crypt_r</code> function on Mac OS X 10.8.2</p>
  
  <pre><code>#define _GNU_SOURCE
  #include &lt;crypt.h&gt;
  </code></pre>
  
  <p>produces </p>
  
  <pre><code>crypt.h: No such file or directory
  </code></pre>
  
  <p>Where can I get the crypt.h file from? Or am I including it wrong?</p>
  
  <p><strong>Edited question - concrete example</strong></p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;stdlib.h&gt;
  
  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;
  }
  </code></pre>
  
  <p>produces</p>
  
  <pre><code>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
  </code></pre>