SDL2 报错:No available video device
搜索后找到了对应的解决方案,原话是这样的
If you built your own SDL, you probably didn’t have development headers
for PulseAudio (or ALSA), so it’s trying to use /dev/dsp, which doesn’t
exist on many modern Linux systems (hence, SDL_Init(SDL_INIT_AUDIO)
succeeds, but no devices are found when you try to open one). “apt-get
install libasound2-dev libpulse-dev” and rebuild SDL…let the configure
script find the new headers so it includes PulseAudio and ALSA support.
其实说白了就是你编译的环境默认使用dsp设备播放,但是由于现代操作系统已经不支持dsp了
你需要安装 libasound2-dev libpulse-dev这些库使SDL能使用PulseAudio播放.
解决办法
sudo apt install libasound2-dev libpulse-dev