1

I have installed FFTW3 in the newest version of ubuntu (downloaded yesterday). when I compile the cpp file I get the error:

fatal error: fftw3.h: No such file or directory.

I used cmd line:

g++ *.cpp -lfftw -lfftw_threads -ls -fopenmp -o test.out

fftw is installed in /home/student/Downloads/fftw-3.3.4 and I located the header file /home/student/Downloads/fftw-3.3.4/api/fftw3.h

Is there something to do with env variables? I am very new to ubuntu and linux, any help will much appreciated.

Please dont close this as a offtopic, I have googled this issue a lot and couldnt find a solution...

4
  • How exactly did you install fftw? Did you install the development components or just runtime libraries? If you have installed to a non-standard location, you will need to set g++ include and library paths appropriately. Why did you not install the normal binary package (libfftw3-dev) from the repositories? Mar 6, 2015 at 19:16
  • Add -I/home/student/Downloads/fftw-3.3.4/api/ and -L/home/student/Downloads/fftw-3.3.4/lib to the compilation line. The -L path might need adjustment depending on where the libraries are.
    – Harris
    Mar 6, 2015 at 19:33
  • @Harris: Thank you, it helped to get rid off the error...Do you have any suggestions to automate this, instead of typing it in the compilation line? Mar 6, 2015 at 21:11
  • @steeldriver: I wasnt aware of that method.. I downloaded the latest file from FFTW.org and installed with --enable_threads FLAG...The installation was fine... Mar 6, 2015 at 21:13

1 Answer 1

0

For a quick solution, add to the compilation line:

-I/home/student/Downloads/fftw-3.3.4/api/ -L/home/student/Downloads/fftw-3.3.4/lib  

The -L path might need adjustment depending on where the libraries are.

To automate this you can add the following to your .bashrc file:

export LDFLAGS="-L/home/student/Downloads/fftw-3.3.4/lib" 
export CFLAGS="-I/home/student/Downloads/fftw-3.3.4/api"
export CPPFLAGS="-I/home/student/Downloads/fftw-3.3.4/api"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/student/Downloads/fftw-3.3.4/lib
1
  • Thank you..this helps...Also I figured out from @steeldriver' s question that I havent installed the FFTW correctly. I didnt login as root to install and couldnt figure out whether it installed correctly or not..Now I reinstalled fftw and problem solved...thank you all for the suggestions... Mar 8, 2015 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .