0
我在VC++中使用FFTW库并尝试运行此代码。当我运行它,我得到以下错误在VC++中链接FFTW时出错
LINK:致命错误LNK1104:无法打开文件“libfftw3l-3.dll”
我做的dll和lib文件从上所指示的FFTW网站并添加了dll文件到我的项目中Linker> Input> Additional Dep。
#include <fftw3.h>
#include <math.h>
int main(void)
{
fftw_complex *in, *out;
fftw_plan p;
int nx = 5;
int ny = 5;
int i;
float M_PI = 3.14;
/* Allocate the input and output arrays, and create the plan */
in = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * nx * ny);
out = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * nx * ny);
p = fftw_plan_dft_2d(nx, ny, in, out, FFTW_FORWARD,
FFTW_ESTIMATE);
/* Now fill the input array with the input data */
/* We'll simply make a sine wave */
for (i = 0; i < (nx * ny); i++) {
in[i][0] = sin(i/10.0 * M_PI); /* Real part */
in[i][1] = 0.0; /* Imaginary part */
}
/* Actually execute the plan on the input data */
fftw_execute(p);
/* Print out the results */
for (i = 0; i < (nx * ny); i++)
printf("Coefficient %d: %f%+f*i\n", i, out[i][0], out[i][1]);
/* Clean up after ourselves */
fftw_destroy_plan(p);
fftw_free(in); fftw_free(out);
return 0;
}
'libfftw3l'是为FFTW的长双倍版本 - 为什么这甚至在你的项目? – 2012-08-14 06:54:17
@ Paul:我只是按照FFTW网站上的说明,所以,你认为我应该从链接器中删除它?我应该在VC++目录还是其他地方添加另一个东西? – Sam 2012-08-14 07:06:45
您需要'libfftw3' DLL,而不是'libfftw3l'或'libfftw3f' DLL。 – 2012-08-14 07:23:35