Getting an error trying to find libfftw3-3.dll after adding the containing folder to "Additional Dependencies" in VS2017


Here is what I did trying to install and use FFTW in Visual Studio 2017 on my 64 bit machine:

  1. Install from this page
  2. Create a new "Windows Console Application" from File>New Project entitled fftw_helloworld. All default settings were used, including the box for Create Directory for Solution.
  3. Opened the Developer Command Prompt for VS 2017, navigated to the unzipped folder containing the fftw files and ran lib /def:libfftw3-3.lib

  4. In Project>fftw_helloworld Properties>C/C++>General>Additional Include Directories, I added the folder containing the fftw files. I did the same in Project>fftw_helloworld Properties>Linker>General>Additional Library Directories. In Project>fftw_helloworld Properties>Linker>Input>Additional Dependencies, I added libfftw3-3.lib.

  5. I ran this code:

    #include "pch.h"
    #include <fftw3.h>
    int main()
    fftw_complex *in, *out;
    fftw_plan p;
    int N = 32;
    in = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * N);
    out = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * N);
    p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
    fftw_execute(p); /* repeat as needed */
    fftw_free(in); fftw_free(out);
    return 0;
  6. I got the system error "The code execution cannot proceed because libfftw3-3.dll was not found. Reinstalling the program may fix this problem". I closed VS, reopened the project, cleaned it, and rebuilt it to no luck.

  7. After searching on Stack Exchange, I saw a potential solution was to add libfftw3-3.dll into the folder containing fftw_helloworld.exe, I did so and the error changed to "The application was unable to start correctly (0xc000007b). Click OK to close the application."

  8. I'm stuck here, I have no idea how to fix this and I need FFTW to continue.

asked on Super User Feb 5, 2019 by user994512

1 Answer


I had the same problem. Go to properties -> Build Events -> Post-Build Event -> Command Line and add this command: xcopy /d /y "$path to your .dll files*.*" "$(TargetDir)"

answered on Super User Jun 12, 2019 by Mostafa

User contributions licensed under CC BY-SA 3.0