Sam
Sam

Reputation: 949

Error Linking FFTW in VC++

I am using the FFTW library in VC++ and trying to run this code. When I run it, I get the following error

LINK : fatal error LNK1104: cannot open file 'libfftw3l-3.dll'

I made the dll and lib files from as indicated on the FFTW website and added the dll files to my project with 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;
} 

Upvotes: 0

Views: 1033

Answers (1)

IKavanagh
IKavanagh

Reputation: 6187

The libfftw3l-3.dll is for the long double version of FFTW. It looks like you do not have this file available on your computer. However, as you don't use any long double functions or any single precision float functions you only need to link against the libfftw3-3.dll library.

Upvotes: 1

Related Questions