title: FFTW3 linking in C
body: <p>I can't link fftw3 library (latest on Mac OS X Yosemite 10.10.5). I have a sample-code from the <a href="http://www.fftw.org/fftw2_doc/fftw_2.html" rel="nofollow noreferrer">developers</a> here:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;/usr/local/include/fftw3.h&gt;
  
  
  int main()
      {
      int N;
  
      fftw_complex *in, *out;
      fftw_plan p;
  
  
      in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
      out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
      p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
  
  
      fftw_execute(p); /* repeat as needed */
  
  
      fftw_destroy_plan(p);
      fftw_free(in); fftw_free(out);
  }
  </code></pre>
  
  <p>I don't expect it to make sense. At this point I was it just to compile.</p>
  
  <p>1) I have followed the manual and tried:</p>
  
  <p>gcc -lm -lfftw3 FFT.c -o FFT</p>
  
  <p>gcc FFT.c -I$/usr/local/include/ -L$/usr/local/include/ -lfftw3 -lm -o FFT</p>
  
  <p>and many other variations. </p>
  
  <p>2) When I open /usr/local/include/, I don't really see a libfftw3-file, however, I have libfftw3.la in /Applications/fftw-3.3.7. Hence, I have also tried </p>
  
  <p>gcc FFT.c -I$/Applications/fftw-3.3.7. -L$/Applications/fftw-3.3.7. -lfftw3 -lm -o FFT</p>
  
  <p>3) I have tried to copy libfftw3.la into /usr/local/include/ and pass option (1) to the terminal again...</p>
  
  <p>All the same error: </p>
  
  <pre><code>ld: warning: directory not found for option '-L$/Applications/fftw-3.3.7.'
  ld: library not found for -lfftw3
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Please, help! Don't know where to look any more. The manual is very high level for me and doesn't seem to cover these issues extensively/completely.</p>