简体   繁体   中英

Problems using FFTW library in Linux and Eclipse IDE

So I'm working with some older code I wrote some time ago. I was originally going to port it to Windows, had some success, but quickly ran into other problems and decided to move back to a *nix environment. The original code compiled and ran just fine in the first try.

I'm running Ubuntu 11.10 and have chosen Eclipse as my IDE. When compiling and running the original code, everything is fine. Now I've installed the FFTW library ([fftw.org][1]) and can't seem to build anything that uses the library.

I installed the library using aptitude in the terminal:

sudo apt-get install libfftw3-dev libfftw3-doc

The library definitely exists:

~$ g++ -lfftw3
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status

And I've added "fftw3" to my project's properties->C++ Linker->Libraries list in Eclipse.

The header file is found just fine.

When I go to compile, every single data type that is defined in the library fails to be defined, so essentially the compiler has no idea what to do.

I'm a bit stumped...

Here's one of the errors (they're all identical): Line:

fftw_real a[M][N];

Error:

error: ‘fftw_real’ was not declared in this scope

I'm not sure what else to try. Your help and expertise is greatly appreciated. Thanks in advance.

SOLVED! Here's the solution

For anyone else working with OLD CODE and low on sleep, searching on Google and StackOverflow for a solution to a similar problem, learn from my stupid mistake instead of making your own.

The key phrase here is old code . My code was written for FFTW 2, but I'm using version 3 of the library, which has a radically different interface. I had to update all my code that uses the library, then everything worked as normal.

Doh! How dumb. I hope someone out in Google land finds this useful some day.

Thank you, Dietmar Kühl, for helping me realize what was wrong. I appreciate you taking the time to install the library and poke around; that was very nice of you.

Using find fftw-3.3 | xargs grep fftw_real find fftw-3.3 | xargs grep fftw_real reveal that

fftw-3.3/ChangeLog: fftw_real is gone

This seems to be the root problem (well, just providing an answer to have this question closed as being answered, really).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM