SDL中没有可用的视频设备

问题描述 投票:1回答:1

我正在使用的SDL-2库是由源码编译的。

每当我试图在X11上运行任何使用SDL-2的程序时,我都会得到这个错误。

SDL_Init Error: No available video device

我在Linux Mint 19.3 Tricia上通过命令行运行这些程序。

下面是 ./configure 摘要。

SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss
Video drivers   : dummy opengl_es2 vulkan
Input drivers   : linuxev linuxkd
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO
c++ c sdl sdl-2
1个回答
2
投票

看起来你的SDL构建缺少X11后端。

Mint看起来很像Debian-y,所以,你可以在Mint上运行。sudo apt build-dep libsdl2 应该拉进所需的 -dev 包。 然后您可以重新运行 ./configure & rebuildreinstall SDL。

确保仔细检查 Video drivers 一行 configure 摘要中有你感兴趣的后端。

如果 build-dep 太过手忙脚乱 docs/README-linux.md 有一个(有点老)的明细 -dev 包清单。

================================================================================
Build Dependencies
================================================================================

Ubuntu 13.04, all available features enabled:

sudo apt-get install build-essential mercurial make cmake autoconf automake \
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
fcitx-libs-dev libsamplerate0-dev libsndio-dev

Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
to that command line for Wayland support.

NOTES:
- This includes all the audio targets except arts, because Ubuntu pulled the 
  artsc0-dev package, but in theory SDL still supports it.
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
  for higher-quality audio resampling. SDL will work without it if the library
  is missing, so it's safe to build in support even if the end user doesn't
  have this library installed.
- DirectFB isn't included because the configure script (currently) fails to find
  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
  configure script to include DirectFB support. Send patches.  :)
© www.soinside.com 2019 - 2024. All rights reserved.