Basic compilation

This page explains how to compile a program that uses Bio++ (source file biohello.cpp) using g++. It is intended at linux users primarily.

In this example we assume that the libraries binaries (.so and/or .a files) are located in directory $HOME/.local/lib and that the library includes tree (.h files) are located in directory $HOME/.local/include. Because these places are non-standard (ie. not /usr/local/lib) they must be passed to the compiler through the -L and -I</tt> parameters.

Remarks

 * The CPATH</tt>/CPLUS_INCLUDE_PATH</tt> and LIBRARY_PATH</tt> environment variables can be used instead of the -I</tt> and -L</tt> parameters, respectively.


 * Programs compiled with dynamic linkage will not run without runtime access to the libraries (.so</tt> files). If the libraries are installed in a non-standard place (ie. not /usr/local/lib</tt>), this place must be added to the runtime LD_LIBRARY_PATH</tt> environment variable.

Dynamic linkage
Here the five libraries are included, you may omit the two last ones if you do not use phylogenetic and/or population genetics classes.

Static linkage
When compiling with static linkage, the order of the libraries to include is important: Here again you may omit the PopGen and Phyl libraries.

Programs compiled with static linkage are stand-alone programs and do not require the libraries to be present when running. The strip</tt> command removes all unused code from the executable, and efficiently decreases its size.