c++ - Return error while trying to compile fftw -
it newbie in c++ question. trying apply fft complex 1d data using fftw.
# include <stdlib.h> # include <stdio.h> # include <time.h> #include <fftw3.h> int main(void) { int i; int n=100; fftw_complex *in; fftw_complex *out; fftw_plan plan_forward; unsigned int seed = 123456789; in= (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*n); out= (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*n); srand ( seed ); ( = 0; < n; i++ ) { in[i][0] = rand ( ); in[i][1] = rand ( ); } plan_forward = fftw_plan_dft_1d ( n, in, out, fftw_forward, fftw_estimate ); fftw_execute ( plan_forward ); ( = 0; < n; i++ ) { printf ( " %3d %12f %12f\n", i, out[i][0], out[i][1] ); } fftw_destroy_plan ( plan_forward ); fftw_free ( in ); fftw_free ( out ); return; }
after compiling getting error:
error: return-statement no value, in function returning ‘int’ [-fpermissive] return;
i have no idea how fix error. appreciated. thanks.
it should be
int n=100;
(note ;
in place of ,
)
and ffftw_malloc
should fftw_malloc
(one f
removed @ beginning).
also, compiler should give line numbers errors, i'd suggest going lines , examining them closely, can learn debugging ;)
finally, main
returns int, return statement needs value. (0
should fine.) note: main
function special in has implicit return 0;
@ end, function return value allowed "fall off end". if use return statement in main
have provide value.
Comments
Post a Comment