Compile your program in this manner:
g++ -O3 -DLINUX -o program program.cpp -Ixxxxx -Lyyyyy -limprov -lpthread && strip program
- -O3 is an optimization flag for the compiler
- -DLINUX defines the preprocessor variable LINUX.
This define is needed to include the proper code for the Linux
operating system rather for than the Windows 95 operating system.
- -o program is an option to name the output program
program. You can name the output program anything you
want. If you do not specify the -o option, the program
will be called a.out.
- program.cpp is the name of your program. It can have
any name and should end in one of the following extensions:
.cpp, .cc, .cxx or .C indicating
a C++ program.
- -Ixxxxx is an option to specify where the header files
for Improv are located. xxxxx should be replaced
with the directory name where the Improv
header files are located on your computer, usually in
improv/include.
- -Lyyyyy is an option to specify where the Improv
library file is located. yyyyy should be replaced
with the directory name where the compiled Improv
library is located, usually in improv/lib.
- -limprov is an option that specifies the library to link
with after compiling your program. The library is called
libimprov.a and its location was specified with the
-L option. Note that if you are using MIDI input,
you also need to add the pthread library.
- && strip program This is an optional part of the
compiling process. && means only run the following
command if the g++ command was successful in creating
the compiled program. strip program removes debugging
information from the file named program. This
information takes up to 80% of the executable program's
size and is (hopefully) not necessary.
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