Headers and Libraries (GNU MP 6.3.0)
Description: How to install and use the GNU multiple precision arithmetic library, version 6.3.0.

### 3.1 Headers and Libraries

All declarations needed to use GMP are collected in the include file `gmp.h`, except for the C++ Class Interface which comes with its own separate header `gmpxx.h`. `gmp.h` is designed to work with both C and C++ compilers.

    #include <gmp.h>

Note however that prototypes for GMP functions with `FILE *` parameters are only provided if `<stdio.h>` is included before.

    #include <stdio.h>
    #include <gmp.h>

Likewise `<stdarg.h>` is required for prototypes with `va_list` parameters, such as `gmp_vprintf`. And `<obstack.h>` for prototypes with `struct obstack` parameters, such as `gmp_obstack_printf`, when available.

All programs using GMP must link against the `libgmp` library. On a typical Unix-like system this can be done with ‘`-lgmp`’, for example

    gcc myprogram.c -lgmp

GMP C++ functions are in a separate `libgmpxx` library, including the C++ Class Interface but also C++ Formatted Output for regular GMP types. This is built and installed if C++ support has been enabled (see Build Options). For example,

    g++ mycxxprog.cc -lgmpxx -lgmp

GMP is built using Libtool and an application can use that to link if desired, see GNU Libtool in GNU Libtool.

If GMP has been installed to a non-standard location then it may be necessary to use ‘`-I`’ and ‘`-L`’ compiler options to point to the right directories, and some sort of run-time path for a shared library.