链接SDL_image错误

时间:2011-09-20 08:45:49

标签: linker linker-errors ld freepascal

我正在尝试在linux机器上安装UltraStarDeluxe。 make使用fpc (Free Pascal)生成的编译脚本。在调用make时,以下是ld退出之前的错误+警告消息:

/usr/bin/ld: warning: ../game/link.res contains output sections; did you forget -T?
/usr/bin/ld: cannot find -lSDL_image
/home/sriram/ultraDX/ultrastardx-1.1-src/src/ultrastardx.dpr(344,1) Error: Error while linking
/home/sriram/ultraDX/ultrastardx-1.1-src/src/ultrastardx.dpr(344,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
make[1]: *** [../game/ultrastardx] Error 1
make[1]: Leaving directory `/home/sriram/ultraDX/ultrastardx-1.1-src/src'
make: *** [all] Error 2

我从here知道警告信息(“你忘记了-T”)是一个错误,已被删除。这是我的问题:

更新 我在互联网上搜索了一些,看到SDL代表简单直接媒体层。我安装了库,现在,根据question here,我的/usr/local/lib包含以下内容:

default.sfx           libSDL-1.2.so.0.11.3  libSDL.la             libSDL.so           
libSDL-1.2.so.0       libSDL.a              libSDLmain.a          pkgconfig/  

然而,如上所述,错误仍然存​​在。我怎么能摆脱他们?

更新2:
@wormsparty:我通过rpm -U SDL_image-1.2.10-1.i586.rpm解决了这些错误。我现在得到package SDL_image-1.2.10-1.i586 is already installed。我还检查了/usr/lib,发现安装了以下库:

 libSDL-1.2.so.0  libSDL-1.2.so.0.11.2  libSDL_image-1.2.so.0  libSDL_image-1.2.so.0.8.2  libSDL.so

这是我应该寻找的吗?

1 个答案:

答案 0 :(得分:2)

您正在寻找提供libSDL_image.so的SDL_image。这是一个独立的图书馆。

尝试安装该库。该包通常命名为SDL_image

你也可以在这里抓住它:http://www.libsdl.org/projects/SDL_image/

编辑:关于包X和X-devel之间的区别:

库的格式为lib${Name}.so.${Version}。也可能有颠覆。该版本用于区分不兼容的版本,例如libpng 1.4和1.5不是二进制兼容的。

当您将程序链接到库时,可以链接到确切的版本号(例如直接gcc test.c /usr/lib/libSDL_image-1.2.so.0.8.2),但您通常并不关心确切的版本号这就是我们创建动态链接的原因:libSDL_image-1.2.so。此链接将指向确切的版本号。

通常,在发行版上,只需要运行时文件的用户既不需要头文件,也不需要那些动态链接。以前,您可能在/ usr / lib中有libSDL_image-1.2.so.${some_number},但缺少libSDL_image-1.2.so动态链接。它由SDL_image-devel包提供。