在linux下安装SDL的扩展库SDL_ttf时出现了如下错误:
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.4... no
*** Could not run SDL test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means SDL was incorrectly installed
*** or that you have moved SDL since it was installed. In the latter case, you
*** may want to edit the sdl-config script: /usr/bin/sdl-config
configure: error: *** SDL version 1.2.4 not found!
提示SDL包的安装版本要>=1.2.4
打开makefile在203行有SDL_VERSION = 1.2.4把1.2.4改成安装的版本(我安装的SDL的版本是1.2.14)1.2.14 保存后重新进行configure时出现
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.14... no
*** Could not run SDL test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means SDL was incorrectly installed
*** or that you have moved SDL since it was installed. In the latter case, you
*** may want to edit the sdl-config script: /usr/bin/sdl-config
configure: error: *** SDL version 1.2.14 not found!
到这是否能想到不是版本的问题呢!!
打开SDL_ttf包下面的READMNE文件 内容如下:
This library is a wrapper around the excellent FreeType 2.0 library,
available at:
http://www.freetype.org/
This library allows you to use TrueType fonts to render text in SDL
applications.
To make the library, first install the FreeType library, then type
'./configure' then 'make' to build the SDL truetype library and the
showfont and glfont example applications.
Be careful when including fonts with your application, as many of them
are copyrighted. The Microsoft fonts, for example, are not freely
redistributable and even the free "web" fonts they provide are only
redistributable in their special executable installer form (May 1998).
There are plenty of freeware and shareware fonts available on the Internet
though, and may suit your purposes.
This library is available under the GNU Library General Public License,
see the file "COPYING" for details.
Enjoy!
-Sam Lantinga (6/20/2001)
在第一段和第三段都有告诉我们,安装SDL_ttf包前先安装FreeType包,我安装 的libfreetype包(版本不同)吗,安装完后,
继续安装SDL_ttf,configure后出现
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.4... yes
checking for X... libraries , headers
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for OpenGL support... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating SDL_ttf.spec
config.status: creating SDL_ttf.pc
config.status: executing libtool commands
config.status: executing depfiles commands
编译通过!!
注:在linux下安装包时,打开安装包下面的文件README 或者INSTALL 阅读一下安装步骤,会少走很多弯路!!