سؤال

I am sure this is a simple issue, but I am having a rough time getting in done. I am using this code snippet from http://www.fftw.org/fftw2_doc/fftw_2.html. I have the library installed (via homebrew). The include folder (/usr/local/include) has

fftw3.f
fftw3.f03
fftw3.h
fftw3l.f03
fftw3q.f03

Here is the code snippet from the site. I have tried it with both fttw.h and fttw3.h

#include <fftw.h>

int main (int argc, char** argv){
 fftw_complex in[N], out[N];
 fftw_plan p;

 p = fftw_create_plan(N, FFTW_FORWARD, FFTW_ESTIMATE);

 fftw_one(p, in, out);

 fftw_destroy_plan(p);  

     return 0;
}

It keeps throwing

fftwtest.c:1:10: fatal error: 'fftw3.h' file not found
#include <fftw3.h>
     ^
1 error generated.
هل كانت مفيدة؟

المحلول

/usr/local/include and /usr/local/lib aren't on the default header search path anymore in Mavericks. You'll need to add them with -I and -L flags, respectively.

نصائح أخرى

I was finally able to install pyfftw via the following, all in one terminal session:

brew install fftw
export DYLD_LIBRARY_PATH=/usr/local/lib
export LDFLAGS="-L/usr/local/include"
export CFLAGS="-I/usr/local/include"
pip install pyfftw

You need the right compiler flags. Add /usr/local/include to your header search path. This is done with the -I flag for the compiler, or if you are using Xcode, you can set it in the project settings.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top