[英]Error Linking FFTW in VC++
我正在VC ++中使用FFTW库,并尝试运行此代码。 运行它时,出现以下错误
链接:致命错误LNK1104:无法打开文件'libfftw3l-3.dll'
我按照FFTW网站上的指示制作了dll和lib文件,并使用Linker> Input> Additional Dep将dll文件添加到了我的项目中。
#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-3.dll
适用于libfftw3l-3.dll
的long double
版本。 您的计算机上似乎没有此文件。 但是,由于您不使用任何long double
精度函数或任何单精度float
函数,因此只需要链接到libfftw3-3.dll
库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.