分类: LINUX
2010-09-07 01:57:30
1.下载sdl
2.
$ tar zxvf SDL-1.2.13.tar.gz
$ cd SDL-1.2.13
$ ./configure ; make
# make install
3.测试一下
#include "SDL.h"/* 所有的SDL程序都需要引入 */
#include
int main() { printf("Initializing SDL.\n") ; /* 初始化Video与Audio */
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)==-1)
{printf("Could not initialize SDL: %s.\n",SDL_GetError());
exit(-1);}
printf("SDL initialized.\n");
printf("Quiting SDL.\n");
SDL_Quit();
printf("Quiting...\n");
exit(0);}
4.编译
gcc t.c -I /usr/local/include/SDL -lSDL -o initializing
5.正确执行应该会出现:
Initializing SDL.
SDL initialized.
Quiting SDL.
Quiting...
否则会出现:
Initializing SDL.
Could not initialize SDL: No available video device.
09年6月6日更新
在ubuntu9.04安装完后出现Could not initialize SDL: No available video device.
网上查询得知装X11库sudo apt -get install libx11-dev
装完后还是不行,make反而不过了。
据说X11早已废弃,被Xorg替代了。
遂sudo apt-get install xorg-dev