在Linux下许多软件都必须有SDL库的支持,尤其是些游戏和比较炫的软件,其中SDL库是夸平台的,用起来十分方便。SDL的定义如下:
baidu百科:SDL(Simple DirectMedia Layer)是一个自由的跨平台的多媒体开发包,适用于 游戏、游戏SDK、演示软件、模拟器、MPEG播放器和其他应用软件。
--------http://baike.baidu.com/view/8348.htm
Wiki:Simple DirectMedia Layer (SDL) is a cross-platform, free and open source multimedia library written in C that presents a simple interface to various platforms' graphics, sound, and input devices. Software developers use it to write computer games or other multimedia applications that can run on many operating systems including Windows, Mac OS X, OS 9, Linux, the PSP, Google Android, AmigaOS, AmigaOS 4, Haiku/BeOS, MorphOS, OpenVMS, Syllable, and WebOS. It manages video, events, digital audio, CD-ROM, sound, threads, shared object loading, networking and timers.
The library is divided into several subsystems namely the Video (handles both surface functions and OpenGL), Audio,CD-ROM, Joystick and Timer subsytems. Besides this basic, low-level support, there also are a few separate official libraries that provide some additional functionality. These comprise the "standard library", and are provided on the offical website and included in the offical documentation:
* SDL_image - support for multiple image formats
* SDL_mixer - complex audio functions, mainly for sound mixing
* SDL_net - networking support
* SDL_ttf - TrueType font rendering support
* SDL_rft - simple Rich Text Format rendering
--------http://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
=====================================SPLIT===================================
1.安装官方包
SDL库大致可分为一下几部分 sdl_image,sdl_mixer,sdl_net,sdl_ttf,sdl_rft,各个库的功能wiki都有明确的解释,一般只需要前4个库就可以了,但是Linux系统中一般需要重新安装SDL,而Centos官方库中只有 SDL.i386 和SDL-devel.i386,可使用yum install 来安装,
[]# yum list *SDL* ---SDL.i386 ---SDL-devel.i386 []# yum install SDL.i386 []# yum install SDL-devel.i386
2.安装扩展包
安装完官方的包后,只能在寻找对应自己系统的运行库和开发库,由于没有Centos官方包的支持,所以软件依赖性的问题折磨了许久,最后发现要现安装runtime版本,再安装development版本(有点费解)。我只安装了前3个,不过后两个也可以以后装,我的系统是Centos5.5所以找到对应的软件包,注意:开发库也就是devel的版本必须和runtime版本是一样的,我下载了这几个包:
SDL_image-1.2.5-4.el5.i386.rpm
SDL_image-devel-1.2.5-4.el5.i386.rpm
SDL_mixer-1.2.4-7.i386.rpm
SDL_mixer-devel-1.2.4-9.i386.rpm
SDL_net-1.2.7-7.el5.i386.rpm
SDL_net-devel-1.2.7-7.el5.i386.rpm
这些添加库中最麻烦也是最重要的就是SDL_image,许多问题就是出在他上面,需要注意。
以后挨个安装每个库就可以了,开发版本要最后装。
到这里 SDL Library 就安装完了,不同的linux版本所需的版本不同,还要区分来装,这样安装后还有不少问题,以后有待解决,不过这样大致就可以用了。
================================================================================================
3.错误解决方案
给出解决一些安装问题的参考的一些网站和帖子:
http://www.linuxquestions.org/questions/linux-software-2/sdl_image-library-not-found-366659/
http://www.libsdl.org/projects/SDL_image/
http://www.linuxquestions.org/questions/linux-newbie-8/sdl-not-found-294856/
http://hintsforums.macworld.com/archive/index.php/t-12342.html
http://forums.libsdl.org/viewtopic.php?t=6553&sid=48da2ff86542b033d14a1dc20d74b975
http://ubuntuforums.org/showthread.php?t=211454
http://www.linuxquestions.org/questions/linux-software-2/not-finding-sdl_image-h-396196/
http://www.idevgames.com/forums/thread-4951-post-27256.html#pid27256
http://ufoai.ninex.info/forum/index.php?topic=5031.0
http://cboard.cprogramming.com/c-programming/90787-non-existant-sdl_image-h.html