Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 5858

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>Building and Installing Software Packages for Linux: Second Example: Xloadimage</TITLE>
 <LINK HREF="Software-Building-HOWTO-11.html" REL=next>
 <LINK HREF="Software-Building-HOWTO-9.html" REL=previous>
 <LINK HREF="Software-Building-HOWTO.html#toc10" REL=contents>
</HEAD>
<BODY>
<A HREF="Software-Building-HOWTO-11.html">Next</A>
<A HREF="Software-Building-HOWTO-9.html">Previous</A>
<A HREF="Software-Building-HOWTO.html#toc10">Contents</A>
<HR>
<H2><A NAME="s10">10. Second Example: Xloadimage</A></H2>

<P>This example poses an easier problem. The <EM>xloadimage</EM> program
seemed a useful addition to my set of graphic tools.  I copied the
<CODE>xloadi41.gz</CODE> file directly from the source directory on the CD
included with the excellent 
<A HREF="Software-Building-HOWTO-16.html#refs">X User Tools</A> book, by
Mui and Quercia. As expected, <EM>tar xzvf</EM> unarchives the files.
The <EM>make</EM>, however, produces a nasty-looking error and
terminates.
<P>
<BLOCKQUOTE><CODE>
<PRE>
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
</PRE>
</CODE></BLOCKQUOTE>
<P>The error message contains the essential clue.
<P>Looking at the file <CODE>image.h</CODE>, line 23...
<BLOCKQUOTE><CODE>
<PRE>
       #include &lt;stdlib.h>
</PRE>
</CODE></BLOCKQUOTE>
<P>Aha, somewhere in the source for <EM>xloadimage</EM>, <EM>wchar_t</EM>
has been redefined from what was specified in the standard include file,
<CODE>stdlib.h</CODE>. Let us first try commenting out line 23 in
<CODE>image.h</CODE>, as perhaps the <EM>stdlib.h include</EM> is
not, after all, necessary.
<P>At this point, the build proceeds without any fatal errors. The
<EM>xloadimage</EM> package functions correctly now.
<P>
<P>
<P>
<P>
<P>
<HR>
<A HREF="Software-Building-HOWTO-11.html">Next</A>
<A HREF="Software-Building-HOWTO-9.html">Previous</A>
<A HREF="Software-Building-HOWTO.html#toc10">Contents</A>
</BODY>
</HTML>