How to compile programs using the Improv library for Linux

Improv example programs

  1. First you must download the Improv distribution file and compile the library. See How to compile the Improv library in Linux if necessary.

  2. After compiling the Improv library, you can compile the associated example programs by executing the following command in the improv directory:
       make examples
    This command will create a directory called improv/bin where it will write the executable files for the example programs.

Compiling your own programs with the Improv library

  1. First you must have and know where are located: (1) the compiled Improv library, and (2) the Improv header files.

  2. In your program, make sure you include the file improv.h near the top of the program like this:
       #include "improv.h"
    Alternatively, you can include just the individual Improv class header files as needed by your program.

  3. Compile your program in this manner:
       g++ -O3 -DLINUX -o program program.cpp -Ixxxxx -Lyyyyy -limprov -lpthread && strip program
    

    You can also examine the Makefile.examples makefile and modify it to make your programs.

    Another way to compile your programs is to write a shell script which adds the necessary options to compile programs. Here is an example which you could try:

    #!/bin/bash
    #
    # A shell script to compile Improv-based programs.
    #
    
    LIBDIR=/home/craig/improv/lib
    INCDIR=/home/craig/improv/include
    NAME=`basename $1 .cpp`
    
    g++ -O3 -DLINUX -o $NAME $NAME.cpp -I$INCDIR \
        -L$LIBDIR -limprov -lpthread && strip $NAME
    
    

    If the above program was called mkimprov and your program was called test.cpp, then you could compile the program by typing

       mkimprov test
    or
       mkimprov test.cpp
    
    
    
    
    
    
    

    This How-To was last updated on Mon Dec 6 12:22:09 PST 1999
    by craig@ccrma.stanford.edu