Although support for GP142 under XWindows gets the least amount of support, it actually works pretty well. There are a few things you need to know.
| Linux | FreeBSD | |
| #include (.h) files | /usr/X11R6/include/X11 | /usr/X11R6/include |
| Libraries | /usr/X11R6/lib | /usr/X11R6/include |
| Sample command line | gcc -idirafter /usr/X11R6/include *.c
-L/usr/X11R6/lib -lX11 -lc -lm |
gcc -idirafter /usr/X11R6/include *.c
-L/usr/X11R6/lib -lX11 -lc -lm |
Your results may vary. You will get messages like "Unable to
open file <Xlib.h>" if the include file directory (the one specified by the
-idirafter switch) is wrong. You will get messages about "undefined reference
to..." for various symbols (e.g., XDrawString) if the library directory (the one
specified by the -L switch) is wrong. In either case, you'll have to look around on
your system to find the correct directories.
XLIBFILES = /usr/X11R6/lib/libX11.so
pcad: pcad.o gp142.o
gcc -o pcad pcad.o gp142.o $(XLIBFILES) -lm
pcad.o: pcad.c
gcc -c pcad.c
gp142.o: gp142.c gp142.h gp142lib.h
gcc -c gp142.c
XLIBFILES = /usr/X11R6/lib/libX11.so
# This is the rule which builds the executable. It depends on
# all of the object files, which are created with the rules below
tron: tronDraw.o tronMove.o hw4.o gp142.o
gcc -g -Wall -ansi -o tron *.o $(XLIBFILES) -lm
# Note that all the files are compiled with the -g, -Wall,
# and -ansi flags.
# -g ensures that debugging symbols are built into your program
# (so you can debug your program with, for example, gdb).
# -ansi enforces strict compliance with the ansi-C spec
# -Wall is short for "Warnings: all". If the warnings grow
# excessive, you may want to remove this flag
hw4.o: hw4.c tron.h
gcc -g -Wall -ansi -c hw4.c
tronDraw.o: tronDraw.c tron.h
gcc -g -Wall -ansi -c tronDraw.c
tronMove.o: tronMove.c tron.h
gcc -g -Wall -ansi -c tronMove.c
gp142.o: gp142.c gp142.h gp142lib.h
gcc -g -ansi -c gp142.c