Guide to compiling with C Interfaces and Implementations (CII)

C Interfaces and implementations a library of data structures and algorithms for C programmers. It has been installed in the COMP 40 class directory, and there is a configuration file for pkg-config.

If you are not familiary with the wonderful pkg-config program, it provides flags to use on the command line with your C compiler:

Example use: compile a C file to relocatable object code

To take a compilation unit myprog.c, which uses the CII libraries through #include, and compile it into a relocatable object file myprog.o:
  gcc -O -ansi -pedantic -Wall -Werror -c `pkg-config --cflags cii40` myprog.c
Let's break down the options:

Example use: combine relocatable object files into an executable program

Let's suppose we have a simple program consisting only of myprog.c and the Hanson CII libraries. To get an executable binary called myprog, we can do this:
  gcc -O -ansi -pedantic -Wall -Werror -o myprog myprog.o `pkg-config --libs cii40` 
Here are the new options: If your program has multiple modules, you might include all the .o files on one command line, as in
  gcc -ansi -pedantic -Wall -Werror -o unblackedges unblackedges.o bit2.o pnmrdr.o `pkg-config --libs cii40`