PDA

View Full Version : fftw unable to compile



superutsav
24th January 2006, 14:03
Hi,

I've downloaded and installed fftw 3.0.1 ( on Mandrake 10, AMD athlon). Now, i am unable to compile any programs using fftw...
I am including the header file <fftw3.h> ion the program.
On running gcc, the compiler throws back this :

/home/utsav/tmp/ccsMtd04.o(.text+0x1a): In function `main':
: undefined reference to `fftw_malloc'
/home/utsav/tmp/ccsMtd04.o(.text+0x2d): In function `main':
: undefined reference to `fftw_malloc'
/home/utsav/tmp/ccsMtd04.o(.text+0x79): In function `main':
: undefined reference to `fftw_plan_dft_1d'
/home/utsav/tmp/ccsMtd04.o(.text+0x8a): In function `main':
: undefined reference to `fftw_execute'
/home/utsav/tmp/ccsMtd04.o(.text+0xe2): In function `main':
: undefined reference to `fftw_destroy_plan'
/home/utsav/tmp/ccsMtd04.o(.text+0xf0): In function `main':
: undefined reference to `fftw_free'
/home/utsav/tmp/ccsMtd04.o(.text+0xfe): In function `main':
: undefined reference to `fftw_free'
collect2: ld returned 1 exit status


What am i doing wrong???

Thanks
superutsav

jacek
24th January 2006, 14:13
Did you add "-lfftw" to tell gcc that you want to link with fftw?

wysota
24th January 2006, 14:14
You're not linking with the library. Add "-lfftw" (or something like that) to your linker flags.

superutsav
24th January 2006, 14:31
Thanks for the -lfftw thing...
However, i now have a new error:


/usr/bin/ld: cannot find -lfftw
collect2: ld returned 1 exit status


superutsav

wysota
24th January 2006, 14:34
Thanks for the -lfftw thing...
However, i now have a new error:


/usr/bin/ld: cannot find -lfftw
collect2: ld returned 1 exit status




locate libfftw
and add -L with a directory where it resides
And check if it is libfftw or libfftw3, maybe you just need to change "-lfftw" to "-lfftw3"

superutsav
24th January 2006, 14:41
Hey... Thanks again... this time, however, there's yet another error, and i think this is an intrinsic fftw error:



/usr/local/lib/libfftw3.a(trig1.o)(.text+0xb9): In function `fftw_sincos':
: undefined reference to `cos'
/usr/local/lib/libfftw3.a(trig1.o)(.text+0xe5): In function `fftw_sincos':
: undefined reference to `sin'
collect2: ld returned 1 exit status



What can i do about this?
superutsav

jacek
24th January 2006, 14:44
: undefined reference to `cos'
[...]
What can i do about this?
You are not linking your program with maths library ("-lm").

superutsav
24th January 2006, 15:10
Thanks guys...
That was an awesome quick reply... the fastest i've ever got on a forum :eek:
problem solved ... thanks
superutsav