[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: programming X

spoiler freeserve co uk <richard@spoiler.freeserve.co.uk> writes:
spoiler> I recently purchased the O'Reilly Xlib Programming Manual
spoiler> with the aim of learning how to write X applications. My
spoiler> problem though is I can't get basicwin.c to compile up at
spoiler> all!

(You probably don't want to write real applications in Xlib...though I 
found reading through that book fairly educational.  Using a toolkit
like Gtk or Qt might be easier.)

spoiler> I even downloaded the O'Reilly version and that didn't
spoiler> work. The O'Reilly version complains that it can't load
spoiler> Xlib.h although my compile line reads
spoiler>     gcc -g -lX11 -o basicwin basicwin.c

Right, since the X header files and libraries are in different
directories.  Try something along the lines of
        gcc -g -I/usr/X11R6/include -L/usr/X11R6/lib -o basicwin basicwin.c

spoiler> My main question though is, should the example work exactly
spoiler> as written in the book or do I need to generate a GNU/Linux
spoiler> version?

Code written using only POSIX functions and Xlib calls (e.g. all of
the examples in the O'Reilly book) should be *very* portable, and will 
probably build without modification on nearly any Un*xish machine,
save modifications to include and link paths as noted above.

David Maze             dmaze@mit.edu          http://donut.mit.edu/dmaze/
"Hey, Doug, do you mind if I push the Emergency Booth Self-Destruct Button?"
"Oh, sure, Dave, whatever...you _do_ know what that does, right?"

Reply to: