AWS GameLift: unresolved external symbol Aws::Malloc

I have been using this [GameLift Client SDK][1] (which is essentially a select few libraries of the [aws-cpp-sdk][2] and some blueprints on top that I don’t use), along with following these wonderful tutorials to get a game session running on AWS GameLift and got clients to connect to it successfully.

However I have hit what appears to be a missing some dependencies within the Client SDK, when I was trying to setup a queue for [AWS FlexMatch][3] in my gameinstance.cpp:

void UT_GameInstance::StartRequest()
{
	auto QueueRequest = Aws::GameLift::Model::CreateGameSessionQueueRequest();

	auto Destination = Aws::GameLift::Model::GameSessionQueueDestination::GameSessionQueueDestination();
	Destination.SetDestinationArn(TCHAR_TO_ANSI(*DestinationID));

	Aws::Vector<Aws::GameLift::Model::GameSessionQueueDestination> Destinations = { Destination };
}

I was trying to use Aws::Vector which is part of the AWSCore but upon build I get the following linker errors:

error LNK2019: unresolved external symbol "void * __cdecl Aws::Malloc(char const *,unsigned __int64)" (?Malloc@Aws@@YAPEAXPEBD_K@Z) referenced in function "private: bool __cdecl std::vector<class Aws::GameLift::Model::GameSessionQueueDestination,class Aws::Allocator<class Aws::GameLift::Model::GameSessionQueueDestination> >::_Buy(unsigned __int64)" (?_Buy@?$vector@VGameSessionQueueDestination@Model@GameLift@Aws@@anonymous_user_e71e0d8a?$Allocator@VGameSessionQueueDestination@Model@GameLift@Aws@@@4@@std@@AEAA_N_K@Z)

error LNK2019: unresolved external symbol "void __cdecl Aws::Free(void *)" (?Free@Aws@@YAXPEAX@Z) referenced in function "public: __cdecl std::vector<class Aws::GameLift::Model::GameSessionQueueDestination,class Aws::Allocator<class Aws::GameLift::Model::GameSessionQueueDestination> >::~vector<class Aws::GameLift::Model::GameSessionQueueDestination,class Aws::Allocator<class Aws::GameLift::Model::GameSessionQueueDestination> >(void)" (??1?$vector@VGameSessionQueueDestination@Model@GameLift@Aws@@anonymous_user_e71e0d8a?$Allocator@VGameSessionQueueDestination@Model@GameLift@Aws@@@4@@std@@QEAA@XZ)

These linker errors are usually encountered when the linker cannot find the correct function definition for a used function declaration. The Client SDKs that I cloned has the AWSCore header files and I also have the aws-cpp-sdk-core dll and lib files in Plugins\GameLiftClientSDK\ThirdParty\GameLiftClientSDK\Win64, like the tutorial instructed, so it should have the correct function definitions.

AWS::Vector is using AWS::Allocator, which is then using Malloc and Free.

AWSVector.h:
template< typename T > using Vector = std::vector< T, Aws::Allocator >;
AWSAllocator.h:
typename Base::pointer allocate(size_type n, const void *hint = nullptr) { AWS_UNREFERENCED_PARAM(hint); return reinterpret_cast(Malloc("AWSSTL", n * sizeof(T))); }

AWSMemory.h:
AWS_CORE_API void* Malloc(const char* allocationTag, size_t allocationSize);

How I have tried to fix this:

  • Figure it might be because the GameLift Client doesn’t have the aws-c-common dependency. So I built and added the lib and dll files, as well as added all the aws-c-common header files and editted the AWSCore build and module files to build it with Unreal’s Build System. Result: Lots of macro is not defined errors which mainly are platform or compiler related so I think it should at least build for Win x64 but no such luck. Macro errors:

    aws/common/assert.h(57): error C4668: '__clang_analyzer__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

    aws/common/predicates.h(21): error C4668: 'AWS_DEEP_CHECKS' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

    AWSMemory.cpp(129): error C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

  • Also tried adding all the aws-c-common files and build from source but hit even more macro errors.

  • Update the aws-cpp-sdk dll and lib files for the GameLift Client. Result: Linker errors persist.

  • Illogically added the [][4] to show AWSMemory.h that Malloc and Free really do exist. Result: Have a guess.

  • Re-adding a GameLift Client version that is on [a pull request][5] as it seemed like one of the devs managed to solve most of the dependency issues (including aws-c-common). Result: unresolved external symbols for now not only Malloc and Free but also CreateGameSessionQueueRequest(), GameSessionQueueDestination(), and most of the other constructors in the snippet of code above.

I have posted this issue on the GameLiftClientSDK GitHub page and in the AWS GameTech forum to little avail.
I just want to use a AWS::Vector and not encounter this issue again with any other of the AWS library functions.

If anyone has any ideas what might be causing Malloc and Free to not be linking I would really appreciate any help.

[1]:
[2]: GitHub - aws/aws-sdk-cpp: AWS SDK for C++
[3]: FlexMatch integration with Amazon GameLift hosting - Amazon GameLift
[4]: aws-sdk-cpp/AWSMemory.cpp at fb252286bf6497a34beabe5e2c3c9fca85a448fc · aws/aws-sdk-cpp · GitHub
[5]: /pull/21