Re: Compile problem (UNCLASSIFIED)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Jul 2007 10:08:00 -0600, Lebsock, Robert (Civ, ARL/SLAD) wrote:

> I've included published code by Paul Bourke that fails to compile.  The
> error message is as attached in the .jpg file.  I have upgraded though 3
> versions of DevC++ - all that changed is the text of the error message.
> The offending lines are highlighted.

[...]

>  int FFT (int dir, int m, double *x, double *y) {

Ok, you've got a function FFT().

[...]

> }
> 
> 
> /*----------------------------------------------------------------------
> ---
>    Perform a 2D FFT inplace given a complex 2D array The direction dir,
>    1 for forward, -1 for reverse The size of the array (nx,ny)
>    Return false if there are memory problems or
>       the dimensions are not powers of 2 */
> 
>  int FFT2D(COMPLEX **c, int nx, int ny, int dir) {
>    int i = 0, j = 0;
>    int m = 0, twopm = 0;
>    double *real,*imag;
> 
>    /* Transform the rows */
>    real = (double *)malloc(nx * sizeof(double)); imag = (double
>    *)malloc(nx * sizeof(double)); if (real == NULL || imag == NULL)
>    {
>       return false;
>    }
>    if (!Powerof2(nx,&m,&twopm) || twopm != nx) {
>       return false;
>    }
>    for (j=0;j<ny;j++)
>    {
>       for (i=0;i<nx;i++)
>       {
>          real[i] = c[i][j].real;
>          imag[i] = c[i][j].imag;
>       }
>   FFT (int dir, int m, double real, double imag);

What the heck is this? It looks like a (re)declaration of your function 
FFT(). Did you perhaps mean to *call* the FFT() like this:

  FFT (dir, m, real, imag);


>       for (i=0;i<nx;i++)
>       {
>          c[i][j].real = real[i];
>          c[i][j].imag = imag[i];
>       }
>    }
>    free(real);
>    free(imag);
> 
>    /* Transform the columns */
>    real = (double *)malloc(ny * sizeof(double)); imag = (double
>    *)malloc(ny * sizeof(double));
> 
>   if (real == NULL || imag == NULL)
>       return false;
>    if (!Powerof2(ny,&m,&twopm) || twopm != ny)
>       return false;
>    for (i=0;i<nx;i++)
>    {
>       for (j=0;j<ny;j++)
>       {
>          real[j] = c[i][j].real;
>          imag[j] = c[i][j].imag;
>       }
>    FFT (int dir, int m, double real, double imag);

And again here:

  FFT (dir, m, real, imag);

>       for (j=0;j<ny;j++)
>       {
>          c[i][j].real = real[j];
>          c[i][j].imag = imag[j];
>       }
>    }
>    free(real);
>    free(imag);
> 
>    return true;
> }

[...]

-- 
Lionel B


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux