Firstly, we need to be able to compile
is a simple UNIX program which uses Xlib, so to compile it we need
cc -o tortoise1 tortoise1.c -I/usr/X11R6/include -lX11 -L/usr/X11R6/lib -lm
To break this down into its constituent parts:
ccis the command to invoke the C compiler and linker.
-o tortoise1says that the executable program should be called
tortoise1.ctells the compiler where to find the source code for the program.
-I/usr/X11R6/include. Your system might have these header files in a different place.
libX11; we tell the linker about it with
libX11library, which is
-L/usr/X11R6/libon my system.
cos) , so we have
The example above is for a RedHat6.0 GNU/Linux system; for other
systems you may well find that the Xlib headers and libraries are
accessible in standard directories like
/usr/lib - in which case, a simple
cc -o tortoise1 tortoise1.c -lX11 -lm
If this doesn't work, you can try one of the following:
cc -o tortoise1 tortoise1.c -I/usr/openwin/include -lX11 -L/usr/openwin/lib -lm
cc -o tortoise1 tortoise1.c -I/usr/include/X11R6 -lX11 -L/usr/lib/X11R6 -lm
cc -o tortoise1 tortoise1.c -I/usr/lpp/X11/include -lX11 -L/usr/lpp/X11/lib/R6 -lm
Once we add Guile functionality to the program, we also need to tell the compiler and linker how to get access to the relevant Guile headers and libraries.
Fortunately, figuring out how to do this is very easy, because Guile comes with a utility to make it easy.
guile-config compile. On my system, this gave
-I/usr/include(which is an include directory that is automatically searched by the compiler anyway).
guile-config link. (On my system, this yielded
-L/usr/lib -lguile -ldl -lreadline -ltermcap -lm)