我一直在尝试让 Allegro5 在我的 Ubuntu 机器上运行。我编译了这段代码:
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if (!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if (!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
收到此错误:
X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 55 (X_CreateGC)
Resource id in failed request: 0x4000002
Serial number of failed request: 25
Current serial number in output stream: 27
尝试了这个解决方案: http ://www.allegro.cc/forums/thread/607530 (将 allegro5.cfg 更改为“config_selection=old”并安装了 mesa-utils)。
我不知道现在该尝试什么。