Using FFTW (the fastest FFT) under Visual Studio 2013

来源:互联网 发布:刘弘章 知乎 编辑:程序博客网 时间:2024/05/29 23:48

Keywords:
FFTW (3.3.4Version), FFT, DFT, C/C++, Visual Studio 2013, Win7/Win8



Step 1.  First visit ffte.org and download the version (32 or 64-bit) of your interest, for precompiled FFTW 3.3.4 windows dlls. 

Here I would like to choose the 32bit version.See Fig 1. Then, extract the files in a target directory, say D:\FFTW32.


Fig 1. Precompiled FFTW 3.3.4 Windows DLLs


Step 2. You should be able to call those DLLs from your compiler. In order to link to them from Visual C++, you will need to create .lib"import libraries" using the Command Prompt program included with VC++. 

You can achieve this objective through the following steps.

1) Open Visual Studio Command Prompt. See Fig 2.
For Visual Studio 2013 in Windows8 or Windows 8.1
On the Start screen, type Visual Studio, and then choose Visual Studio Tools. (To access the Start screen, press the Windows logo key on your keyboard.)
In File Explorer, choose Developer Command Prompt for VS2013.
For Visual Studio (any version) in Windows 7
Choose Start, and then choose All Programs, Microsoft Visual Studio, Visual Studio Tools, Visual Studio Command Prompt.


Fig 2 Visual Studio 2013 Command Prompt in Windows 7

2)Within VS2013 x86 Native Tools Command Prompt, Change the current directory to the target one “D:\FFTW32\fftw-3.3.4-dll32”, which include those .dll files. Please Run: cd /dD:\FFTW32\fftw-3.3.4-dll32. See Fig 3 for results.


Fig 3 Change Current Directory to D:\FFTW32\fftw-3.3.4-dll32


3)Within VS2013 x86 Native Tools Command Prompt, Run the following commands. SeeFig 4 for results.
a) On Visual Studio 2008 in 32-bit mode, Run:

  • lib/machine:ix86 /def:libfftw3-3.def
  • lib/machine:ix86 /def:libfftw3f-3.def
  • lib/machine:ix86 /def:libfftw3l-3.def
b) On Visual Studio 2008 in 64-bit mode, Run:
  • lib/machine:x64 /def:libfftw3-3.def
  • lib/machine:x64 /def:libfftw3f-3.def
  • lib /machine:x64/def:libfftw3l-3.def
So, under the directory of D:\FFTW32\fftw-3.3.4-dll32, you can find the newly generated files (libfftw3-3.exp, libfftw3-3.lib, libfftw3f-3.exp, libfftw3f-3.lib, libfftw3l-3.exp, libfftw3l-3.lib), as well as one originally existing important header file (i.e., fftw3.h). See Fig 5.



Fig 4 Results of Run VS2013 x86 Native Tools Command Prompt


Fig 5 Generated Files


Step 3. Thelast four steps, in Visual C++, are the following. 

Now, open Visual Studio and:
  • Go to: Project -> Properties -> Configuration Properties ->VC++ Directories -> Include Directories, and then add the D:\FFTW32\fftw-3.3.4-dll32to the Include Directories;

  • Go to: Project ->Properties -> Configuration Properties -> VC++ Directories -> LibraryDirectories, and then add the D:\FFTW32\fftw-3.3.4-dll32, to the Library Directories;
  • Go to: Project ->Properties -> Configuration Properties -> VC++ Directories -> Linker-> Input, and then add the libfftw3-3.lib and/or libfftw3f-3.liband/or libfftw3l-3.libto the Additional Dependencies.
  • Copy the three .dll FFTW files (Note: .dll files, NOT .lib files) into the folder of your project where.vcxproj and .vcxproj.filters are located.

Remember that FFTW can deal with floating point,double precision and long double numbers.The libfftw3f-3.lib library is for floating points, the libfftw3-3.libis for double precision and libfftw3l-3.lib is for long double.

That's all. This procedure works fine for me.
Enjoy the Fastest Fourier Transform in the West (FFTW) in your IDE!


0 0
原创粉丝点击