这个例子提出一个更简单的问题。xloadimage 程序似乎是对我的图形工具集的一个有用的补充。我直接从随附于优秀的 X User Tools 书籍的光盘上的源代码目录中复制了 xloadi41.gz
文件,该书由 Mui 和 Quercia 撰写。正如预期的那样,tar xzvf 解压缩了这些文件。然而,make 产生一个难看的错误并终止。
gcc -c -O -fstrength-reduce -finline-functions -fforce-mem
-fforce-addr -DSYSV -I/usr/X11R6/include
-DSYSPATHFILE=\"/usr/lib/X11/Xloadimage\" mcidas.c
In file included from /usr/include/stdlib.h:32,
from image.h:23,
from xloadimage.h:15,
from mcidas.c:7:
/usr/lib/gcc-lib/i486-linux/2.6.3/include/stddef.h:215:
conflicting types for `wchar_t'
/usr/X11R6/include/X11/Xlib.h:74: previous declaration of
`wchar_t'
make[1]: *** [mcidas.o] Error 1
make[1]: Leaving directory
`/home/thegrendel/tst/xloadimage.4.1'
make: *** [default] Error 2
错误消息包含关键线索。
查看文件 image.h
,第 23 行……
#include <stdlib.h>
啊哈,在 xloadimage 的源代码的某处,wchar_t 已经被重新定义,与其在标准包含文件 stdlib.h
中指定的不同。让我们首先尝试注释掉 image.h
中的第 23 行,因为也许 stdlib.h include 毕竟不是必要的。
此时,构建过程没有出现任何致命错误。xloadimage 软件包现在可以正常工作了。