Compilation

| Home | Libraries | People | FAQ | More

## Compilation

Boost.Geometry is a headers-only library. Users only need to include the library headers in their programs in order to be able to access definitions and algorithms provided by the Boost.Geometry library. No linking against any binaries is required.

Boost.Geometry is only dependant on headers-only Boost libraries. It does not introduce indirect dependencies on any binary libraries.

In order to be able to use Boost.Geometry, the only thing users need to do is to download and/or install Boost and specify location to include directories, so `include` directives of this scheme will work:

    #include <boost/...>

#### Supported Compilers

Boost.Geometry library has been successfully tested with the following compilers:

- MSVC (including Express Editions)
  - 14.0 (MSVC 14 CTP)
  - 12.0 (MSVC 2013)
  - 11.0 (MSVC 2012)
  - 10.0 (MSVC 2010)
  - 9.0 (MSVC 2008)
  - 8.0 (MSVC 2005)
- gcc
  - gcc 5.0.0
  - gcc 4.9.2
  - gcc 4.9.0
  - gcc 4.8.4
  - gcc 4.8.1
  - gcc 4.8.0
  - gcc 4.7.3
  - gcc 4.7.2
  - gcc 4.7.0
  - gcc 4.6.4
  - gcc 4.6.2
  - gcc 4.6.1
  - gcc 4.6.0
  - gcc 4.5.3
  - gcc 4.5.2
  - gcc 4.4.7
  - gcc 4.4.0
  - gcc 4.3.4
  - gcc 4.2.1
  - gcc 3.4.6
- clang
  - clang 3.6
  - clang 3.5
  - clang 3.4
  - clang 3.3
  - clang 3.2
  - clang 3.1
  - clang 3.0
  - clang 2.9
- darwin
  - darwin 4.0.1
  - darwin 4.4
- intel
  - intel 11.1
  - intel 11.0
  - intel 10.1
- pathscale
  - pathscale 4.0.8

Boost.Geometry uses Boost.Build, a text-based system for developing and testing software, to configure, build and execute unit tests and example programs. The build configuration is provided as a collection of `Jamfile.v2` files.

For gcc, flag `-Wno-long-long` can be used to surpress some warnings originating from Boost.

#### Includes

The most convenient headerfile including all algorithms and strategies is `geometry.hpp`:

    #include <boost/geometry.hpp>

This is the main header of the Boost.Geometry library and it is recommended to include this file.

Alternatively, it is possible to include Boost.Geometry header files separately. However, this may be inconvenient as header files might be renamed or moved occasionaly in future.

Another often used header is `geometries.hpp`:

    #include <boost/geometry/geometries/geometries.hpp>

This includes definitions of all provided geometry types:

- point,
- linestring,
- polygon,
- ring,
- multi_point,
- multi_linestring,
- multi_polygon,
- box,
- segment.

The file `geometries.hpp` is not included in the `geometry.hpp` headerfile because users should be given the liberty to use their own geometries and not the provided ones. However, for the Boost.Geometry users who want to use the provided geometries it is useful to include.

#### Advanced Includes

Users who have their own geometries and want to use algorithms from Boost.Geometry might include the files containing registration macro's, like:

    #include <boost/geometry/geometries/register/point.hpp>

#### Performance

The enumeration below is not exhaustive but can contain hints to improve the performance:

- For Microsoft MSVC, set define `_SECURE_SCL=0` for preprocessor.
- For Microsoft MSVC, set define `_HAS_ITERATOR_DEBUGGING=0` for preprocessor.
- Use of STLport, a popular open-source implementation of the STL, may result in significantly faster code than use of the C++ standard library provided by MSVC.
- Turn on compiler optimizations, compile in release mode.

#### Problems with Intellisense

Both versions of MSVC, 2005 and 2008 (including Express Editions) can hang trying to resolve symbols and give IntelliSense suggestions while typing in a bracket or angle bracket. This is not directly related to Boost.Geometry, but is caused by problems with handling by this IDE large C++ code base with intensively used templates, such as Boost and Boost.Geometry. If this is inconvenient, IntelliSense can be turned off:

> “(...)disabling IntelliSense in VC++. There is a file called `feacp.dll` in `<VS8INSTALL>/VC/vcpackages` folder. Renaming this file will disable Intellisense feature.”

> -- Intellisense issues in Visual C++ 2005