Raspberry pi Raspberry Pi 4上的SDL2:SDL初始化失败没有可用的视频设备

Raspberry pi Raspberry Pi 4上的SDL2:SDL初始化失败没有可用的视频设备,raspberry-pi,sdl,sdl-2,sdl-image,Raspberry Pi,Sdl,Sdl 2,Sdl Image,我在获取一个使用SDL编译的程序时遇到问题,因此为了修复它,我按照以下链接重新安装了SDL2和SDL2Image: 我以前使用过这个链接,并且成功地创建了窗口和渲染器。 现在程序编译并运行,但我得到了错误 SDL Initialization failed no available video device 初始化SDL时 我不确定正在使用什么视频系统,因为配置命令禁用了mir wayland x11和opengl。本教程介绍了如何强制使用opengl es 对于SDL2: 我下载了tar文件

我在获取一个使用SDL编译的程序时遇到问题,因此为了修复它,我按照以下链接重新安装了SDL2和SDL2Image: 我以前使用过这个链接,并且成功地创建了窗口和渲染器。 现在程序编译并运行,但我得到了错误

SDL Initialization failed no available video device
初始化SDL时

我不确定正在使用什么视频系统,因为配置命令禁用了mir wayland x11和opengl。本教程介绍了如何强制使用opengl es

对于SDL2:

我下载了tar文件并将其解压缩到我的主目录中,然后使用以下命令进行配置:

../configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
结果是:

SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   :
Audio drivers   : disk dummy oss alsa(dynamic) sndio
Video drivers   : dummy opengl_es1 opengl_es2
Input drivers   : linuxev linuxkd
Using libudev   : YES
Using dbus      : YES
然后我用了:make-j4

然后:sudomakeinstall

对于SDL2_图像:

我配置为:../configure,没有摘要

然后:make-j4

然后:sudomakeinstall

我刚刚尝试了教程链接提供的测试程序,它正确执行并显示图像,以下是初始化代码:

int main(int argc, char** argv) {
     // Initialize SDL
     check_error_sdl(SDL_Init(SDL_INIT_VIDEO) != 0, "Unable to initialize SDL");
 
     // Create and initialize a 800x600 window
     SDL_Window* window = SDL_CreateWindow("Test SDL 2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
                                           800, 600, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);
     check_error_sdl(window == nullptr, "Unable to create window");
 
     // Create and initialize a hardware accelerated renderer that will be refreshed in sync with your monitor (at approx. 60 Hz)
     SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
     check_error_sdl(renderer == nullptr, "Unable to create a renderer");
 
     // Set the default renderer color to corn blue
     SDL_SetRenderDrawColor(renderer, 100, 149, 237, 255);
 
     // Initialize SDL_img
     int flags=IMG_INIT_JPG | IMG_INIT_PNG;
     int initted = IMG_Init(flags);
     check_error_sdl_img((initted & flags) != flags, "Unable to initialize SDL_image");
我将代码完全复制到我的代码中,而不再获得SDL Init。失败,但我收到以下错误:

Unable to initialize SDL_image Invalid renderer
Unable to create texture Invalid renderer
Unable to create texture Invalid renderer
Unable to create texture Invalid renderer
它是这个测试文件的一对一副本,所以我不确定会发生什么。有什么建议吗

更新:

重新编译测试程序后,它也不再工作,并给出SDL Init failed错误。我用这一行编译:

g++ -std=c++0x -Wall -pedantic sdl2_test.cpp -o sdl2_test `sdl2-config --cflags --libs` -lSDL2_image

我重新配置并安装,而不是配置:

../configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
我只是做了:

../configure

不确定这是否会带来其他问题,但目前可以捕获图像显示和键盘输入。

我重新配置并安装了,而不是配置:

../configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
我只是做了:

../configure
不确定这是否会带来其他问题,但目前可以捕获图像显示和键盘输入