首先安装mysy2官方的压缩包

(链接:MSYS2

下载fft包:FFTW Download Page(要下载 fftw-3.3.10.tar.gz而不是fftw-3.3.5-dll32.zip

下载完后找个位置解压,在菜单里面打开mysy2终端(mysy2mingw64,蓝色的图标),打开fft包的目录输入指令:

./configure --prefix=/mingw64 --enable-shared --disable-static --enable-threads --with-combined-threads --enable-sse2 --enable-avx --enable-float --with-our-malloc

等待一段时间,得到结果:

再执行:

make -j4

执行make install得到:

等待执行完成,输入以下指令验证是否安装完成:

ls /mingw64/bin/libfftw3-3.dll      
ls /mingw64/include/fftw3.h          
ls /mingw64/lib/libfftw3.dll.a 

博主是使用vscode,这边也贴一下vscode连接fftw3库的方法:

在vscode里配置json文件:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "E:/MinGW/MSYS2/mingw64/include"  
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "E:/MinGW/MSYS2/mingw64/bin/gcc.exe",  
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

如果运行时候报错:fft一些函数没有定义:在终端里面输入:

g++ 你想执行的代码.cpp -o 你想执行的代码 -lfftw3 -std=c++17

最后在终端里运行:

./你想执行的代码

便可得到结果。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐