Boost logo

Boost Users :

Subject: [Boost-users] Using Boost.Geometry with Clang/LLVM & VC14
From: degski (degski_at_[hidden])
Date: 2016-03-14 03:50:55

GGL does not compile with the combo of Clang/LLVM (
and VC14 out of the box. There seem to be comflicts in the resolution of
old MSVC bugs and Clang. On windows __clang__ is defined at the same time

Undefining the macro _MSVC_VER before #include
<boost/geometry/geometry.hpp> does however solve the problem (in my use

file: boost/geometry.hpp

// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 Mateusz Loskot, London, UK.

// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.

// Use, modification and distribution is subject to the Boost Software
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at


#if defined(__clang__) && defined(_MSC_VER)
#undef _MSC_VER

#include <boost/geometry/geometry.hpp>

#if defined(__clang__) && defined(__BOOST_GEOMETRY_MSVC_CLANG_WORKAROUND__)


I've run into similar problems before (cannot remember where) with other
boost libraries (which I hacked in other ways).

Clang/LLVM with MSVC (and the IDE) works extremely well for a while now.
The advantages of Clang/LLVM are well known, no need to spell them out It
produces far faster code (almost twice as fast on simple matrix
multiplication f.e.. It also gives the best of two worlds as it supports
Clang and GCC extensions on Windows (calculated goto), while maintaining
(although with a suppressable warning) M$ extensions as well, f.e. in-class
template specialization.

Clang/LLVM (3.9.0 as it stands) is much faster than Clang/CL2 (CodeGen)

I would herewith like to request the development team to integrate
Clang/LLVM on Windows as another supported platform.

Have good day to you all,


This is Bunny. Copy and paste Bunny into your
signature to help him gain world domination!

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at