C++ Online Import Issues

All of the resources I’ve seen for using UE5 and C++ with multiplayer session management tell me to use includes like:

#include "Online/OnlineSessionSettings.h" for things like FOnlineSessionSettings.

However, this include and many others that are sometimes referenced, don’t seem to exist.

image

I’ve enabled more than the minimum required “Online”/“OnlineSubSystem” plugins in the engine, just to be safe. I’ve also restarted UE and made sure to rebuild my Visual Studio Project files.

I’ve seen that the files I’m looking for (like the above) DO exist under paths like "UE_5.5/Engine/Plugins/Online/OnlineSubsystem/Source/Public/OnlineSessionSettings.h" but including directly from that file results in a failed build.

Is there a step I’m missing? Are all of these code-snippets and guides I’ve seen that out of date?

Hi, you didn’t mention adding OnlineSubsystem to your build.cs, so that might be your missing step.

To clarify, just add “OnlineSubsystem” to PublicDependencyModuleNames or PrivateDependencyModuleNames;

Thank you for this.

To anyone else who stumbles onto this: I had to add that line, then have the engine rebuild the project files and I think things are in order. The path I was using previously isn’t the one I need (it’s now Interfaces/OnlineSessionSettings) but I’m hoping this means all the pathing issues are solved.