Chapter 11. Compiling Regina Into a C++ Project

Regina offers its mathematical core as a C++ shared library. This means that your own C++ applications can make use of Regina's functionality, much like they might use any other mathematical library.

Regina is released under the GNU General Public License, which restricts how you may use it in other software. These restrictions are to benefit and encourage mathematical software that is free to use, modify and redistribute. For further information, please read the license details or write to the authors if you have any specific questions.

Installing the Development Files

To build Regina into your own projects, you must install Regina's development files; that is, the C++ headers and development libraries.

  • If you downloaded an RPM-based GNU/Linux package (e.g., for Fedora, Mandriva or SUSE), you should already have the development files installed. Check that the headers are present in /usr/include/regina/.

  • If you downloaded a Debian-based GNU/Linux package (e.g., for Debian or Ubuntu), you will need to install the separate package regina-normal-dev. Check that the headers are present in /usr/include/regina-normal/.

  • If you built Regina yourself, you should already have the C++ headers and development libraries installed. Check that the headers are present in /usr/local/include/regina/ (or wherever you chose to install Regina).

  • If you use Windows or if you downloaded the drag-and-drop app bundle on macOS, the development files are not available. This is because it is too difficult at present to ensure that your development environment is compatible.

Regina uses some other libraries in turn, and you will need the development files for these libraries also. You should install these through ready-made packages if at all possible: they are available in every major GNU/Linux distribution. The extra libraries you will need are:

GNOME XML library (libxml2)

Look for a package named libxml2-dev, lib64xml2-devel or libxml2-devel.

GNU multiprecision arithmetic libraries for C/C++ (libgmp and libgmpxx)

Look for a package named libgmp-dev, lib64gmp-devel, libgmp-devel or gmp-devel. Some distributions (such as Mandriva) ship the C++ library separately in a package named gmpxx-devel.

On some platforms you might also need development files for the zlib compression library (libz), the Jansson JSON library (libjansson), and a lightweight database library (which will be one of Tokyo Cabinet (libtokyocabinet), QDBM (libqdbm) or the Lightning Memory-Mapped Database (liblmdb)). Which of these you need will depend on how your linker works and how Regina was built. If you do need any of these, look for a package named zlib1g-dev, zlib1-devel or zlib-devel, a package named libjansson-dev, libjansson-devel or jansson-devel, and an appropriate option from libtokyocabinet-dev, libtokyocabinet-devel, tokyocabinet-devel, libqdbm-dev, qdbm-devel, liblmdb-dev, liblmdb-devel or lmdb-devel.