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