Hi, I’ve been having issues compiling a c++ actor component, the compiler keeps giving these errors
menu_gamelift.cpp.obj : error LNK2019: unresolved external symbol “void * __cdecl Aws::Malloc(char const *,unsigned __int64)” (?Malloc@Aws@@YAPEAXPEBD_K@Z) referenced in function “public: void __cdecl Umenu_gamelift::SearchForAvailableGameSessions(void)” (?SearchForAvailableGameSessions@Umenu_gamelift@@QEAAXXZ)
menu_gamelift.cpp.obj : error LNK2019: unresolved external symbol “void __cdecl Aws::Free(void *)” (?Free@Aws@@YAXPEAX@Z) referenced in function “public: __cdecl std::basic_string,class Aws::Allocator >::~basic_string,class Aws::Allocator >(void)” (??1?$basic_string@DU?$char_traits@D@std@@anonymous_user_e71e0d8a1?$Allocator@D@Aws@@@std@@QEAA@XZ)
E:\PAWNIK\UE4\PAWNS\Binaries\Win64\UE4Editor-PAWNS-1774.dll : fatal error LNK1120: 2 unresolved externals
I can’t seem to figure out what exactly is causing the errors, here’s the .cpp file:
#include "menu_gamelift.h"
#include "Engine.h"
#include "SearchGameSessionsRequest.h"
#include "CreateGameSessionRequest.h"
#include "GameLiftClientObject.h"
using namespace Aws;
//Sets default values for this component's properties
Umenu_gamelift::Umenu_gamelift()
{
PrimaryComponentTick.bCanEverTick = true;
#if WITH_GAMELIFTCLIENTSDK
//Create gamelift object
GameLiftClientObeject = UGameLiftClientObject::CreateGameLiftObject("placeholder text", "placeholder text");
#endif
}
void Umenu_gamelift::SearchForAvailableGameSessions()
{
#if WITH_GAMELIFTCLIENTSDK
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Blue, TEXT("Searching for available games"));
}
std::string FleetAliasId_std = std::string(TCHAR_TO_UTF8(*FleetAliasId));
Aws::String FleetAliasId_aws(FleetAliasId_std.c_str(), FleetAliasId_std.size());
Aws::GameLift::Model::SearchGameSessionsRequest Request;
Request.SetAliasId("FleetAliasId_aws");
Request.SetFilterExpression("playerSessionCount=0 AND hasAvailablePlayerSessions=true");
Aws::GameLift::Model::SearchGameSessionsResult Result;
auto AvailableGameSessions = Result.GetGameSessions();
if (AvailableGameSessions.size() > 0)
{
auto gameSessionId = AvailableGameSessions[0].GetGameSessionId();
}
else
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Blue, TEXT("No available games found"));
}
}
#endif
}
And the .h file:
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GameLiftClientObject.h"
#include "menu_gamelift.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class PAWNS_API Umenu_gamelift : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
Umenu_gamelift();
UPROPERTY()
class UGameLiftClientObject* GameLiftClientObeject;
UFUNCTION(BlueprintCallable, Category = Custom)
void SearchForAvailableGameSessions();
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Custom)
FString FleetAliasId;
protected:
public:
};