You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows系统下PortAudio安装与编译故障求助

Windows下安装PortAudio失败求助

我尝试在Windows系统中安装PortAudio,但所有方法均失败。试过网上各类教程、YouTube视频,咨询朋友、社交平台及ChatGPT,但都无效。部分安装方法直接失败,少数看似成功的,运行代码时会报错:

main.cpp:1:11: fatal error: portaudio.h: No such file or directory

我尝试过的方法包括:

  • 方法1:
    PS *project folder*> cd build
    PS *project folder*\build> cmake -G "MinGW Makefiles" *portaudio folder*
    PS *project folder*\build> mingw32-make
    *project folder*\build>mingw32-make install
    
  • 方法2:执行命令时出现错误
    cd lib/portaudio ./configure *PortAudio tgz file* | tar -xz -C lib
    tar: Error opening archive: Failed to open '\T\.\toapet0'a
    
  • 方法3:
    tar -xvzf *PortAudio .tgz file* *project folder*
    
  • 方法4:使用PortAudio的.sln文件
  • 方法5:将PortAudio文件夹复制到项目目录
  • 方法6:使用CMake软件(完全无效)

我曾在IDE终端、管理员模式CMD及Makefile中执行上述部分命令,也尝试编写CMakeLists.txt,但不确定是否正确。此外已安装chocolatey(通过PowerShell获取make命令)、msys、mingw及cmake。

恳请各位提供可行方案,支持任意C++ IDE(已有VS、VS Code、CodeBlocks,也可使用其他工具)。感谢!:)

更新补充:
我再次尝试方法1(cmake -G "MinGW Makefiles"),并在默认Makefile中添加执行规则:

execute_run: main.cpp
    g++ -o $@ $^ -I./portaudio/include ./libportaudio.a

(无法复制完整代码,因内容过长)

我在终端执行:

make execute_run
./execute_run

当main.cpp中无PortAudio相关代码时可正常运行,但加入Pa_开头的PortAudio命令后,报错如下:

make execute_run

collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:3: execute_run] Error 1

./execute_run

./execute_run : The term './execute_run' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
name, or if a path was included, verify that the path is correct and try again.

内容的提问来源于stack exchange,提问作者Lotan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 21:28:28