Eclipse (Kepler) 및 MinGW (gcc 4.7.2)를 사용하는 Windows 8 시스템의 C 프로그램에서 FFTW .dll (v 3.3.3)을 사용하려고합니다. 거기에 내가 의심이 문제는 내 구성 할되어 있습니다Eclipse와 mingw를 사용하여 fftw의 배열 크기 제한?
- 미만 977, 프로그램 실행의 배열의 크기와 예상 출력을 생성; N> = 977이면 출력없이 프로그램이 중단됩니다.
- N < 977로 실행하면 예상되는 결과가 나오지만 디버깅은 완전히 다른 값을 제공합니다.
누구나 올바른 방향으로 나를 가리킬 수 있습니까?
코드 :
#include <stdio.h>
#include <stdlib.h>
#include <complexUtil.h>
#include <fftw3.h>
#define N 976
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);
FILE* infile;
float value;
int i = 0;
// Populate input array from file
infile = fopen("testData.txt", "r");
for (i=0; i<N; i++) {
fscanf(infile, "%f", &value);
(*(in + i)) = value + 0.0i;
}
fclose(infile);
// Perform fft
p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(p);
fftw_destroy_plan(p);
fftw_free(in); fftw_free(out);
// Debug output
printf("in\t\tout\n");
for (i=0; i<N; i++) {
printf("%f\t%f\n",
creal((fftw_complex)* (in + i)),
creal((fftw_complex)* (out + i)));
}
return(0);
}
컴파일러는 호출
gcc "-IC:\\Users\\Brian\\workspace\\psd\\src" "-IC:\\Users\\Brian\\workspace\\psd\\lib" "-includeC:\\Users\\Brian\\workspace\\psd\\src\\complexUtil.h" "-includeC:\\Users\\Brian\\workspace\\psd\\src\\fftw3.h" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\psd.o" "..\\src\\psd.c"
gcc "-LC:\\Users\\Brian\\workspace\\psd\\lib" -Wl,--stack,2048 -o psd.exe "src\\psd.o" -lfftw3-3
정상 출력 :
in out
0.188000 348.455000
0.000000 29.738027
0.021000 -88.468551
0.021000 16.764387
0.021000 -48.056287
...
디버그 출력 :
in out
-2656984258037080400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000 -2656984258037080400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000
-2656984258037080400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000 -2656984258037080400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000
...
,
추가 증상 : 디버그 모드에서 출력 루프를 통해 일정 반복 횟수까지 스테핑하면서 출력이 표시되지 않습니다. 그런 다음 출력 블럭을 얻었고 Eclipse의 스테핑 기능이 회색으로 표시됩니다.
*** 'int' ***'main()'... –
@ H2CO3 의견은 문제와 아무런 관련이 없습니다. – JackCColeman