I called the UJoinSessionCallbackProxy::JoinSession() interface in c++, but it couldn’t find the implementation, but I also added “OnlineSubsystem” to build.cs,
“OnlineSubsystemUtils”, these two modules.
Here is the code:
void AVRPawnC2::OnFindSessionSuccess(const TArray& Results)
{
FString debugString = FString::Printf(TEXT(“FindSessionSuccess %d”), Results.Num());
GEngine->AddOnScreenDebugMessage(2, 4.f, FColor::Green, debugString);
UE_LOG(LogTemp, Log, TEXT(“FindSessionSuccess %d!”), Results.Num());
if (Results.Num())
{
APlayerController* pl = GetController();
if (!pl)
{
return;
}
//JoinSessionBlueprint(Results[0]);
JoinProxy = UJoinSessionCallbackProxy::JoinSession(this, pl, Results[0]);
JoinProxy->OnSuccess.AddDynamic(this, &AVRPawnC2::OnJoinSessionSuccess);
JoinProxy->OnFailure.AddDynamic(this, &AVRPawnC2::OnJoinSessionFailure);
JoinProxy->Activate();
}
}
The following is the error message:
VRPawnC2.cpp.obj : error LNK2019: unresolved external symbol “public: static class UJoinSessionCallbackProxy * __cdecl UJoinSessionCallbackProxy::JoinSession(class UObject *,class APlayerController *,struct FBlueprintSessionResult const &)” (?JoinSession@UJoinSessionCallbackProxy@@SAPEAV1@PEAVUObject@@PEAVAPlayerController@@AEBUFBlueprintSessionResult@@@Z),function “public: void __cdecl AVRPawnC2::OnFindSessionSuccess(class TArray<struct FBlueprintSessionResult,class TSizedDefaultAllocator<32> > const &)” (?OnFindSessionSuccess@AVRPawnC2@@QEAAXAEBV?$TArray@UFBlueprintSessionResult@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z) The symbol is referenced in
1>E:\yangyang\UE5_Projects\UnderWaterCorals\Binaries\Win64\UnrealEditor-UnderWaterCorals.dll : fatal error LNK1120: 1 unresolved external command