How to add Boost library to UE project

I downloaded boost and added the paths to my config properties → VC++ directories->Include directories (C:\boost_1_56_0\boost;$(IncludePath)) / Library directories (C:\boost_1_56_0\libs;$(LibraryPath)) (visual studio 2013)

When I try to include a header i get this error:

fatal error C1083: Cannot open include file: ‘boost/lambda/lambda.hpp’: No such file or directory

Intellisense sees all the boost headers when i added the header

Any suggestions?

Thanks

Hi,

since I’m also working on linking a static C++ lib to a Unreal Project I may share one important insight to this:

  1. Do not set up header and library search path in the IDE’s Project files. The build process is externalized and only triggered from MS VS or Xcode. That build process doesn’t care about that settings, it just cares about the C# based build scriptis. See Using the Unreal Engine Build Pipeline | Unreal Engine 5.2 Documentation and https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html

  2. it may be helpfull to add include dir to your IDEs header search path if the intellisense / codecompletion is not working even if you C# stuff is set up properly. Anyway after specifiing it there you may regenerate your project files to make it work without hacking arround in the (anyway generated) project files.

  3. you need to edit your MyProject.Build.cs of your C++ Code “module” (which is your game code module) to add header path and lib path like it is described here: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

  4. It may be that your lib requires changes to the build config. Anyway it is not helping to set this in your IDE (like VS or Xcode) Those settings, e.g. C++ Exceptions enabled (as it is required for linking Poco lib) has to be done in a C# script.

  5. I’m currently struggling myself on where to enable that ONLY for the module and not for the entire Unreal engine.

  6. For the latter I found in How can I enable unwind semantics for C++-style exceptions? - Programming & Scripting - Epic Developer Community Forums the hint to set bForceEnableExceptions to true in UEBuildConfiguration.cs which is located in UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Configuration if you checked out UE source code from github.

  7. I still hope to find a My-module-only solution, so please if anybody know how to set the required stuff e.g. in my MyProject.Build.cs

I hope I clarified some stuff but I still need to find the final way to make it work. Any help is very appreciated here!

ciao

Some answers / corrections to want I wrote before:

for 2.: there is no need to edit header search path of your IDE. If set up in the C# build script and regenerate you project file and it will be in the header search path.

to 5. theoretically its possible to enforce/ enable RTTI and C++ Exceptions (which is needed for Pocolib) with build params, but the get ignored for Mac and iOS Builds.
e.g. MyProject.build.cs:

public MyProject(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP" });
        
        // Enable RTTI (prop. of superclass ModuleRules defined in UnrealEngine/Engine/Source/Programs/UnrealBuildTool/System/RulesCompiler.cs )
        bUseRTTI = true;
        // this seems be ignored on a mac, check UnrealEngine/Engine/Source/Programs/UnrealBuildTool/Mac/MacToolChain.cs

        // Enable C++ Exceptions for this module
        bEnableExceptions = true;
        // eventually needed as well
        UEBuildConfiguration.bForceEnableExceptions = true;

I ended up pulling out the headers I needed from the boost library and adding them manually to my project.