Last updated: May 30, 2026

Getting Started


This page gives an example procedure for installing the kv library and running sample programs.

If you already understand that kv is header-only, requires C++ and Boost, and may require MPFR depending on what you use, you probably do not need to read the rest of this page.

1. Installing the kv Library

After extracting the archive kv-0.x.xx.tar.gz, you will see:
LICENSE.txt  README.txt  example  kv  test
The actual library is the kv directory. Copy it to an appropriate location. On Unix-like systems, a typical location is /usr/local/include. Since the library is small, it is also fine to keep it together with your working directory. If you install it somewhere other than a location that the compiler searches automatically, such as /usr/include or /usr/local/include, specify the installation location at compile time with an option such as:
-I.
-I/home/username/include

2. Installing Dependencies

To use the kv library, you need a C++ compiler and The Boost C++ Libraries. If you use interval arithmetic with MPFR endpoints, you also need The GNU MPFR Library. Typical installation methods are shown below. If MPFR is also required, run the commands in parentheses as well.

2.1 Linux

For Debian-based distributions such as Ubuntu:
sudo apt install build-essential
sudo apt install libboost-all-dev
(sudo apt install libmpfr-dev)
For Red Hat-based distributions such as Fedora:
sudo dnf install gcc-c++
sudo dnf install boost-devel
(sudo dnf install mpfr-devel)

2.2 macOS

(This assumes that you use Homebrew.)

2.3 Windows + Visual C++

(If you use WSL, follow the Linux installation instructions. Using WSL is recommended.)

3. Running Sample Programs

Assume that you are in the test directory immediately after extracting the archive. In other words, kv is located in "..". If it is in another location, replace the path as appropriate.

3.1 Linux

c++ -O3 -DNDEBUG -I.. test-interval.cc
For programs that use MPFR:
c++ -O3 -DNDEBUG -I.. test-impfr.cc -lmpfr

3.2 macOS

(Replace g++15 with the version that is actually installed.)
g++-15 -O3 -DNDEBUG -I.. test-interval.cc
For programs that use MPFR:
g++-15 -O3 -DNDEBUG -I.. test-impfr.cc -lmpfr

3.3 Windows + Visual C++

(This assumes that vcpkg_installed is visible in the same location as kv and test. If it is elsewhere, replace the path as appropriate.)
cl /EHsc /O2 /I.. /I../vcpkg_installed/x64-windows/include test-interval.cc
For programs that use MPFR, the DLL directory must be added to PATH first:
set PATH=%PATH%;../vcpkg_installed/x64-windows/bin
Then run:
cl /EHsc /O2 /I.. /I../vcpkg_installed/x64-windows/include test-impfr.cc /link /LIBPATH:../vcpkg_installed/x64-windows/lib mpfr.lib