FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data。
1. 登陆http://www.fftw.org/install/windows.html下载 32-bit version: fftw-3.3.4-dll32.zip (2.4MB)
2. 将zip解压到某一文件夹,例如D:\LIB
3. 打开VS命令提示或者运行下输入CMD,将文件路径定位到D:\LIB。(VS命令提示:工具-> ;菜单->附件->运行)(DOS下进入某一个盘用D:,而进入子文件需要加上cd ;如进入D盘是D:,而进入D:\LIB输入cd D:\LIB)
4. 输入命令:
lib /def:libfftw3-3.def
lib /def:libfftw3f-3.def
lib /def:libfftw3l-3.def
生成默认的X86架构lib文件
for X64,
lib /machine:x64 /def:libfftw3-3.def
lib /machine:x64 /def:libfftw3f-3.def
lib /machine:x64 /def:libfftw3l-3.def
5. 将D:\LIB下的libfftw3-3.dll、libfftw3f-3.dll、libfftw3l-3.dll复制到C:\Windows\SysWOW64下
6. 将D:\LIB下的fftw3.h放到C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include下
7. 在VS中,项目—>属性—>配置属性—>VC++目录中的包含目录,引用目录,库目录加上D:\LIB
8. 现在可以进行下面程序的测试了,如果程序不能运行可以将D:\LIB中的libfftw3-3.dll、libfftw3f-3.dll、libfftw3l-3.dll放到工程目录下(这一步备选)
#pragma comment(lib, "D:\\LIB\\libfftw3-3.lib")
#pragma comment(lib, "D:\\LIB\\libfftw3f-3.lib")
#pragma comment(lib, "D:\\LIB\\libfftw3l-3.lib")
#include <stdio.h>
#include <stdlib.h>
#include <fftw3.h>
#define N 5
int main()
{
fftw_complex *in, *out;
fftw_plan p;
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);
p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
int n;
for(n=0; n<N; n++)
{
in[n][0] = 1;
in[n][1] = 2;
}
//printf("\n");
fftw_execute(p);
fftw_destroy_plan(p);
for(n=0; n<N; n++)
{
printf("%3.2lf+%3.2lfi ", out[n][0], out[n][1]);
}
printf("\n");
fftw_free(in); fftw_free(out);
return 0;
}
http://bbs.youkuaiyun.com/topics/390815673