Next Previous Contents

## 10. Second Example: Xloadimage

This example poses an easier problem. The xloadimage program seemed a useful addition to my set of graphic tools. I copied the `xloadi41.gz` file directly from the source directory on the CD included with the excellent X User Tools book, by Mui and Quercia. As expected, tar xzvf unarchives the files. The make, however, produces a nasty-looking error and terminates.

> `

>     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

> `

The error message contains the essential clue.

Looking at the file `image.h`, line 23...

> `

>            #include <stdlib.h>

> `

Aha, somewhere in the source for xloadimage, wchar_t has been redefined from what was specified in the standard include file, `stdlib.h`. Let us first try commenting out line 23 in `image.h`, as perhaps the stdlib.h include is not, after all, necessary.

At this point, the build proceeds without any fatal errors. The xloadimage package functions correctly now.

Next Previous Contents