Firstly, we need to be able to compile tortoise1
. This
is a simple UNIX program which uses Xlib, so to compile it we need
something like:
cc -o tortoise1 tortoise1.c -I/usr/X11R6/include -lX11 -L/usr/X11R6/lib -lm
To break this down into its constituent parts:
cc
is the command to invoke the C compiler and linker.-o tortoise1
says that the executable program should
be called tortoise1
.tortoise1.c
tells 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 -lX11
libX11
library, which is -L/usr/X11R6/lib
on my system.libm
(for sin
and cos
) , so we have
-lm
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/include
and
/usr/lib
- in which case, a simple
cc -o tortoise1 tortoise1.c -lX11 -lm
will suffice
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
)