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?
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)
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.
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.