# How to add Boost library to an Unreal Engine 4 project (visual studio 2013)

**URL:** <https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [August 18, 2014, 11:17pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680 "2014-08-18T23:17:56Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![falola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@falola](https://forums.unrealengine.com/u/falola)\
**Post date:** [August 18, 2014, 11:17pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/1 "2014-08-18T23:17:56Z")

</div>

I’m having trouble adding the boost library to my project. i tried following the boost instructions but it seem that the unreal engine project doesn’t have the settings that the boost instructions say to use. I’m trying to use the header only method but i also built all the static libraries. I added the path to the config properties -\> VC++ directories include path and library path but when I include a file in a header I get an error saying it can’t find the source file even though intellisense saw the boost library files.

Has anyone successfully added boost library to their project and if so can you guide me on the steps you took to get it working?

Thanks

---

<div class="post-metadata">

**Author:** ![kylawl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kylawl](https://forums.unrealengine.com/u/kylawl)\
**Post date:** [August 19, 2014, 12:03am UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/2 "2014-08-19T00:03:44Z")

</div>

> [@falola;120999](#):
>
> I’m having trouble adding the boost library to my project. i tried following the boost instructions but it seem that the unreal engine project doesn’t have the settings that the boost instructions say to use. I’m trying to use the header only method but i also built all the static libraries.

I think you can simply drop boost into your game project directory (preferably in a sub-directory called boost) and you should be able to start using it after that.

May I ask what exactly you intend to use from boost, UE4 may already provide the facilities you’re looking for.

> [@falola;120999](#):
>
> I added the path to the config properties -\> VC++ directories include path and library path but when I include a file in a header I get an error saying it can’t find the source file even though intellisense saw the boost library files.

You can’t modify the project file directly; after adding new code, you must regenerate your game project file. (Right click on the uproject and Generate Project Files.

[https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html](https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html)

---

<div class="post-metadata">

**Author:** ![falola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@falola](https://forums.unrealengine.com/u/falola)\
**Post date:** [August 19, 2014, 12:39am UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/3 "2014-08-19T00:39:53Z")

</div>

I’ll give putting the boost library directly into my project a shot. I want to use the boost graph data structure

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8284f935](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8284f935](https://forums.unrealengine.com/u/anonymous_user_8284f935)\
**Post date:** [April 1, 2015, 2:45am UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/4 "2015-04-01T02:45:18Z")

</div>

> [@kylawl;121015](#):
>
> I think you can simply drop boost into your game project directory (preferably in a sub-directory called boost) and you should be able to start using it after that.
> 
> May I ask what exactly you intend to use from boost, UE4 may already provide the facilities you’re looking for.
> 
> You can’t modify the project file directly; after adding new code, you must regenerate your game project file. (Right click on the uproject and Generate Project Files.
> 
> [https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html](https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html)

You mentioned that UE4 already provides these facilities. Could you give me a hint how to implement a force-directed graph drawing for static mesh actors with blueprints? Thank you in advance!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_10b2fd67](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_10b2fd67](https://forums.unrealengine.com/u/anonymous_user_10b2fd67)\
**Post date:** [April 1, 2015, 7:42pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/5 "2015-04-01T19:42:39Z")

</div>

> [@C;261809](#):
>
> You mentioned that UE4 already provides these facilities. Could you give me a hint how to implement a force-directed graph drawing for static mesh actors with blueprints? Thank you in advance!

To be fair, kylawl said that UE4 _may_ provide the functionality - probably to help falola skip integrating a rather large library if possible. That said, if UE4 doesn’t have it and falola needs it, then integrating boost is perfectly fine and should be do-able as kylawl pointed out.

EDIT: If I’m reading sarcasm where there is none, then I apologize. The internet has made me paranoid.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5e51152a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5e51152a](https://forums.unrealengine.com/u/anonymous_user_5e51152a)\
**Post date:** [February 19, 2016, 11:22am UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/6 "2016-02-19T11:22:09Z")

</div>

Hi,

I tried to use Boost with unreal engine, using UE4 build system, as stated above, but run into problems very soon. Reason for using boost in my case is advanced logging. I need to use boost logging, which is not in header files, but in binary libs. In advance, it requires RTTI to be enabled. This, however not pleasant, is not hard to achieve by placing bUseRTTI = true; into build.cs file.

I enabled RTTI and built project in DebugGame Editor configuration with debug versions of boost libs. I run into following error:

1\> Using the /RTC option without specifying a debug runtime will lead to linker errors  
1\> Hint: go to the code generation options and switch to one of the debugging runtimes  
1\>D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/config/auto\_link.hpp(111): fatal error C1189: #error : “Incompatible build options”

So I have tried to use shipping with boost release version of libs (for I presume /RTC is not enabled there) and run in another problem:

D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(28): error C2988: unrecognizable template declaration/definition  
1\> D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(34) : see reference to class template instantiation ‘boost::type\_traits\_detail::mp\_valid\_impl\<F,T…\>’ being compiled  
1\>D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(28): error C2059: syntax error : ‘\<end Parse\>’  
1\>D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(30): error C2332: ‘class’ : missing tag name  
1\>D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(30): error C3306: ‘boost::type\_traits\_detail::\<unnamed-tag\>’: unnamed class template is not allowed  
1\>D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(31): error C2238: unexpected token(s) preceding ‘;’  
1\>D:\Projects\ProjectName\ThirdParty\Boost\Includes\boost/type\_traits/detail/mp\_defer.hpp(34): fatal error C1903: unable to recover from previous error(s); stopping compilation

Right now, I have spent some 14 hours of trying to make this work, and right now I am totally out of ideas. If anybody managed to made boost run with UE4(4.9 using VS 2013), I would be more than glad if You could help me.

.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bd2a818d1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bd2a818d1](https://forums.unrealengine.com/u/anonymous_user_bd2a818d1)\
**Post date:** [March 18, 2016, 1:42pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/7 "2016-03-18T13:42:47Z")

</div>

The answer is that this is a bug. I’ve made a bug report linked below. The problem is that Unreal uses a lot of macros with commonplace naming, which leads to them conflicting with Boost, and other library’s commonplace object names. It’s okay for these libraries’ objects to have commonplace naming because the objects obey namespace and scope rules, whereas macros don’t. This is why Bjarne Stroustrup has been telling C++ programmers to stop using macros and use templates for nearly 2 decades now. (additional link below)

> **[Constant Library Conflicts](https://forums.unrealengine.com/questions/391017/constant-library-conflicts.html)**
>
> There is a plague in the unreal code base known as macros. You guys name them with commonplace words like “check” (the most frequent offender in my experience) and that’s a problem. There are documented issues with HUGELY popular libraries not the...

[http://www.stroustrup.com/bs\_faq2.html#macro](http://www.stroustrup.com/bs_faq2.html#macro)

---

<div class="post-metadata">

**Author:** ![NullP0inter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NullP0inter](https://forums.unrealengine.com/u/NullP0inter)\
**Post date:** [June 27, 2016, 12:50am UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/8 "2016-06-27T00:50:20Z")

</div>

I added boost headers to my project as an external plugin and my initial proof of concept seems to be working.

My high level steps were the following:

- Open one of the Unreal Editor projects =\> Edit =\> Plugins =\> New Plugin. Select Third Party Library Plugin and Create Plugin.
- Editor the example project CS files as appropriate and replaced the Third Party source files with boost c++
- Add the plugin as a dependency to your projects CS build file.

I was then able to use boost header only classes in a blueprint function library without error. I haven’t tested out with any of boost non “header only” classes.

I backed up my proof of concept boost plugin and can share if there is a good place to post.

---

<div class="post-metadata">

**Author:** ![woppin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@woppin](https://forums.unrealengine.com/u/woppin)\
**Post date:** [October 16, 2016, 4:00pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/9 "2016-10-16T16:00:32Z")

</div>

> [@NullP0inter;555023](#):
>
> I backed up my proof of concept boost plugin and can share if there is a good place to post.

Github perhaps?

---

<div class="post-metadata">

**Author:** ![tedderch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tedderch](https://forums.unrealengine.com/u/tedderch)\
**Post date:** [November 23, 2016, 9:53am UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/10 "2016-11-23T09:53:22Z")

</div>

Does anyone solve this problem?

---

<div class="post-metadata">

**Author:** ![jeancf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jeancf](https://forums.unrealengine.com/u/jeancf)\
**Post date:** [December 10, 2016, 2:08pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/11 "2016-12-10T14:08:31Z")

</div>

@tedderch didn’t the solution proposed by @NullP0inter work for you?

---

<div class="post-metadata">

**Author:** ![Vertex\_Soup](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vertex\_Soup](https://forums.unrealengine.com/u/Vertex_Soup)\
**Post date:** [February 1, 2017, 5:48pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/12 "2017-02-01T17:48:08Z")

</div>

> [@NullP0inter;555023](#):
>
> I added boost headers to my project as an external plugin and my initial proof of concept seems to be working.
> 
> My high level steps were the following:
> 
> - Open one of the Unreal Editor projects =\> Edit =\> Plugins =\> New Plugin. Select Third Party Library Plugin and Create Plugin.
> - Editor the example project CS files as appropriate and replaced the Third Party source files with boost c++
> - Add the plugin as a dependency to your projects CS build file.
> 
> I was then able to use boost header only classes in a blueprint function library without error. I haven’t tested out with any of boost non “header only” classes.
> 
> I backed up my proof of concept boost plugin and can share if there is a good place to post.

Could you please elaborate on it little more as I’m trying to use boost (graph part of it) myself. It would help me kickstart development of my systems, I tried to replicate but I have no idea yet how should I swap code you mentioned. I need nested graphs and would like to use Boost instead of coding it all from scratch as their implementation looks way more polished that one I could do myself.  
Thank you.

---

<div class="post-metadata">

**Author:** ![NullP0inter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NullP0inter](https://forums.unrealengine.com/u/NullP0inter)\
**Post date:** [February 18, 2017, 8:02pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/13 "2017-02-18T20:02:04Z")

</div>

Which UE4 and boost version are you using? I will see if I can provide an example.

---

<div class="post-metadata">

**Author:** ![NullP0inter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NullP0inter](https://forums.unrealengine.com/u/NullP0inter)\
**Post date:** [February 18, 2017, 10:35pm UTC](https://forums.unrealengine.com/t/how-to-add-boost-library-to-an-unreal-engine-4-project-visual-studio-2013/9680/14 "2017-02-18T22:35:54Z")

</div>

If all you want are the boost headers its fairly straight forward. Here: [GitHub - NullP0inter/UE4\_Boost](https://github.com/NullP0inter/UE4_Boost) is an example of the headers working. The TestingGrounds level blueprint calls the testGraph method defined in BoostTestFunctionLibrary and you can see the output in the log. I pulled the graph example from the boost website.
