compiling

# Compiling

# Compiling Boost.Geometry

Boost.Geometry is a Header Only library. So just including the headerfiles is enough to use the algorithms. Nothing has to be linked.

Boost.Geometry is only dependant on (header only) Boost libraries. Download the Boost Library Collection from www.boost.org, adapt the include path to include Boost.

# Platforms

The library currently compiles successfully on the following platforms:

- MS Visual Studio 2008 (Express Edition)

- MS Visual Studio 2005 (Express Edition)

- gcc version 3.4

- gcc version 4 (tested are 4.1, 4.2, 4.4)

For Visual Studio, the examples contains some project files (for 2005). However, because the library is header only, it will be no problem to integrate it in your own project files.

The test and example folders contain also Jam-files for bjam / boost-build

For gcc, the flag -Wno-long-long can be used (surpressing warnings originating from Boost)

# Convenient includes

This section concentrates on how to include GGL.

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

- #include <boost/geometry/geometry.hpp> It is recommended to include this file. Alternatively, it is possible to include GGL headerfiles separately. However, this is inconvenient as files might be renamed or moved occasionaly.

An often used headerfile is geometries.hpp:

- #include <boost/geometry/geometries/geometries.hpp> This includes all default geometries: point, linestring, polygon, linear_ring, box. It is not included in the "geometry.hpp" headerfile because users are allowed to use their own geometries. However, for library users who want to use the provided geometries it is most useful.

For users using only Cartesian points, with floating point coordinates (double), in 2D or 3D, you can use instead:

- #include <boost/geometry/geometries/cartesian2d.hpp> This includes all 2D Cartesian geometries: point_2d, linestring_2d, etc. Using this headerfile the library seems to be a non-template library, so it is convenient for users that are not so into the template world.

# Advanced includes

This section is for users who have their own geometries and want to use algorithms from the Boost.Geometry.

If you want to use your own points it makes sense to use the registration macro's:

- #include <boost/geometry/geometries/register/point.hpp> macro's for point registration

- #include <boost/geometry/geometries/register/box.hpp> macro's for box registration

# Extensions

The GGL is currently (since 0.5) split into the kernel and several extensions. As this split is relatively new, there are not yet umbrella-include files, but most things below will do:

If you want to use the geographic coordinate system:

- the tag is already included in the kernel

- #include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp> for Andoyer distance calculations

- #include <boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp> for Vincenty distance calculations

If you want to use the projections:

- #include <boost/geometry/extensions/gis/projections/parameters.hpp>

- #include <boost/geometry/extensions/gis/projections/projection.hpp>

- #include <boost/geometry/extensions/gis/projections/factory.hpp>

If you want to use the circle (n-sphere)

- #include <boost/geometry/extensions/nsphere/...> Several headerfiles, there is not yet a common include

# Performance

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

- For Microsoft, set the define _SECURE_SCL=0

- For Microsoft, set the define _HAS_ITERATOR_DEBUGGING=0

- our measurements indicate that MSVC 2005 generates faster code than MSVC 2008

- Using StlPort results in significant faster code than Microsoft's standard library

- Of course turn on compiler optimizations, compile in release mode

# Intellisense issues

Microsoft Visual Studio (Express) 2005 and 2008 can hang typing in a bracket or angle bracket. This is not directly related to GGL, but caused by heavy templated libraries such as Boost and GGL. If this is inconvenient, intellisense can easily 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.

Source: http://blogs.msdn.com/yash/archive/2007/09/19/intellisense-issues-in-visual-c-2005.aspx