error LNK2019: unresolved external symbol for FOnlineSessionSettings::Get<class FName>(class FName,class FName &)

Hi everyone, i am actually starting to lose my mind after trying to fix this for the whole day :slight_smile:

I get following error messages when trying to compile my code:

FLobbyData.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl FOnlineSessionSettings::Get(class FName,class FName &)const " (??$Get@VFName@@@FOnlineSessionSettings@@QEBA_NVFName@@AEAV1@@Z) referenced in function “public: __cdecl FLobbyData::FLobbyData(class FOnlineSessionSearchResult const &)” (??0FLobbyData@@QEAA@AEBVFOnlineSessionSearchResult@@@Z)

E:\Gamedev\UnrealProjects\Project_Tavern\Binaries\Win64\UnrealEditor-Project_Tavern-8487.dll : fatal error LNK1120: 1 unresolved externals

Here’s the full .cpp file causing the issue:

// Fill out your copyright notice in the Description page of Project Settings.

#include "FLobbyData.h"

#include "SessionSubsystem_CPP.h"
#include "OnlineSubsystemUtils.h"
#include "OnlineSessionSettings.h"

FLobbyData::FLobbyData(): PublicConnections(0), MaxPublicConnections(0), IsLAN(false)
{
	LobbyName = TEXT("NULL");
}

FLobbyData::FLobbyData(const FOnlineSessionSearchResult& Result)
{
	if (Result.Session.SessionSettings.Get(SETTING_LOBBYNAME, LobbyName) == false)
	{
		LobbyName = TEXT("NULL");
	}

	MaxPublicConnections = Result.Session.SessionSettings.NumPublicConnections;
	const int32 openConnections = Result.Session.NumOpenPublicConnections;
	PublicConnections = MaxPublicConnections - openConnections;

	IsLAN = Result.Session.SessionSettings.bIsLANMatch;
	SessionSearchResult = Result;
}

The line that’s causing the problem seems to be:

Result.Session.SessionSettings.Get(SETTING_LOBBYNAME, LobbyName)

Apparently, the linker can’t find the implementation of FOnlineSessionSettings::Get, which is strange because calling FOnlineSessionSettings::Set elsewhere works just fine

What i have already tried:

-Adding (“OnlineSubsystem”, “OnlineSubsystemUtils”) to PrivateDependencyModuleNames
-Clearing the project cache and regenerating Visual Studio project files
-Reinstalling UE
-Trying this code in a fresh project with a different version of UE
-Restarting PC

At this point, I’m out of ideas. I’ve searched this forum for similar issues, but nothing has worked for me so far. Any suggestions would be greatly appreciated!

Thanks in advance!

After playing around i found the solution for my problem…

When I used FString instead of FName for my LobbyName variable, it started compiling:

UPROPERTY(BlueprintReadOnly)
// FName LobbyName;
FString LobbyName;

I have no clue why that is, because to my knowledge, both FName and FString are value types and should work with that template function…

FName is not a valid session setting. Here are all the supported types.