# How to use boost::geometry in UE5?

**URL:** <https://forums.unrealengine.com/t/how-to-use-boost-geometry-in-ue5/2119401>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [November 13, 2024, 4:23am UTC](https://forums.unrealengine.com/t/how-to-use-boost-geometry-in-ue5/2119401 "2024-11-13T04:23:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OctoberIC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OctoberIC](https://forums.unrealengine.com/u/OctoberIC)\
**Post date:** [November 13, 2024, 4:23am UTC](https://forums.unrealengine.com/t/how-to-use-boost-geometry-in-ue5/2119401/1 "2024-11-13T04:23:42Z")

</div>

The C++ library Boost is natively located in : C:\Program Files\Epic Games\UE\_5.4\Engine\Source\ThirdParty\Boost

Adding “Boost” to the build.cs public dependencies and rebuilding doesn’t throw exceptions, but I get a lot of these after adding the header #include \<boost/geometry.hpp\> in any C++ file or any other header referencing that library.

```auto
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(18): error C2988: unrecognizable template declaration/definition
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(18): note: the template instantiation context (the oldest one first) is
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(22): note: see reference to class template instantiation 'boost::multiprecision::detail::has_signed_types<T>' being compiled
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(18): error C2059: syntax error: '<end Parse>'
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(18): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(19): error C2062: type 'char' unexpected
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(19): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(21): error C2760: syntax error: '{' was unexpected here; expected 'expression'
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(21): error C2988: unrecognizable template declaration/definition
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(21): error C2059: syntax error: '{'
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(21): error C2988: unrecognizable template declaration/definition
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(21): error C2059: syntax error: '=='
  C:\Program Files\Epic Games\UE_5.4\Engine\Source\ThirdParty\Boost\boost-1_82_0\include\boost\multiprecision\traits\is_backend.hpp(21): error C2238: unexpected token(s) preceding ';'

...

```

How to properly integrate Boost libraries into UE5?

---

<div class="post-metadata">

**Author:** ![OctoberIC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OctoberIC](https://forums.unrealengine.com/u/OctoberIC)\
**Post date:** [November 13, 2024, 7:33am UTC](https://forums.unrealengine.com/t/how-to-use-boost-geometry-in-ue5/2119401/2 "2024-11-13T07:33:25Z")

</div>

I found the solution. Here it goes. 🙂

“BOOST\_GEOMETRY\_NO\_ROBUSTNESS” is optional and used to make boost::geometry use float32 - 64 values and not higher-precision floats.

> #define BOOST\_GEOMETRY\_NO\_ROBUSTNESS
> 
> THIRD\_PARTY\_INCLUDES\_START  
> #pragma push\_macro(“CONSTEXPR”)  
> #undef CONSTEXPR  
> #pragma push\_macro(“dynamic\_cast”)  
> #undef dynamic\_cast  
> #pragma push\_macro(“check”)  
> #undef check  
> #pragma push\_macro(“PI”)  
> #undef PI
> 
> #include \<boost/geometry.hpp\>  
> #include \<boost/geometry/geometries/point.hpp\>  
> #include \<boost/geometry/geometries/box.hpp\>  
> #include \<boost/geometry/index/rtree.hpp\>
> 
> #pragma pop\_macro(“PI”)  
> #pragma pop\_macro(“check”)  
> #pragma pop\_macro(“dynamic\_cast”)  
> #pragma pop\_macro(“CONSTEXPR”)  
> THIRD\_PARTY\_INCLUDES\_END
