The macro "SEARCH_PRESENCE" cannot be resolved

So I’m now making a simple game in order to learn online-subsystem, but now I’m stuck at this point:
Rider (I use Rider instead of VS as my IDE) said “cannot resolve symbol SEARCH_PRESENCE”, restarting Rider IDE or Unreal cannot work either.
Here’s the code:

void AMultiplayerDemoCharacter::JoinGameSession()
{
	//Find game sessions
	if(!OnlineSessionInterface.IsValid())
	{
		return;
	}

	OnlineSessionInterface->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);
	
	SessionSearch = MakeShareable(new FOnlineSessionSearch());
	SessionSearch->MaxSearchResults = 10000;
	SessionSearch->bIsLanQuery = false;
	SessionSearch->QuerySettings.Set( , true, EOnlineComparisonOp::Equals);
	
	const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
	OnlineSessionInterface->FindSessions(*LocalPlayer->GetPreferredUniqueNetId(),SessionSearch.ToSharedRef());
	
}

So did I missed something?
Thx if someone could help me.

3 Likes

Hey! I stumbled on your post while trying to figure this out myself and then randomly stumbled onto the answer. You need #include "Online/OnlineSessionNames.h" to access the macro.

I figure it out by double-tapping Shift in Rider and searching the entire project for that macro name, which gave me the file to include. Hope that helps :slight_smile:

17 Likes

It works! Thank you so much! :slight_smile:

1 Like

Thank you! Your suggestion helped me, too, when migrating my project from 5.3 to 5.4!

it works thanks