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

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?


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.

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

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.


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.


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)

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.

Github perhaps?

Does anyone solve this problem?

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

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.

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

If all you want are the boost headers its fairly straight forward. Here: GitHub - 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.