By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Building the GameLift Server SDK plugin for Unreal Engine versions greater than 4.21

0

In the past, I have not dealt with any errors while building the plugin when I add it on a per-project basis, meaning I usually add the plugin to a Plugin folder in my Unreal projects rather than Unreal Engine's Engine\Plugins folder. I have made a somewhat similar post about suppressing some warnings, but now I want to address how to solve actual compiler errors in addition to warnings when you try to add the plugin to Unreal Engine itself. And again, I am not sure at all why this only happens when adding the plugin directly to the engine as opposed to adding the plugin to individual projects.

Assuming you are using the plugin in the UE4.21.1 folder in GameLift_09_03_2019\GameLift-SDK-Release-3.4.0\GameLift-Unreal-plugin-3.3.0,

First, to remove the "Refrenced directory ... does not exist" warnings in GameLiftServerSDK.Build.cs, replace the first two lines in the GameLiftServerSDK constructor,

PublicIncludePaths.AddRange(
    new string[] {
    "GameLiftServerSDK/Public"
    }
);  

PrivateIncludePaths.AddRange(
    new string[] {
    "GameLiftServerSDK/Private",
    }
);

with

PublicIncludePaths.Add(System.IO.Path.Combine(ModuleDirectory, "Public"));
PrivateIncludePaths.Add(System.IO.Path.Combine(ModuleDirectory, "Private"));

Next, there are also two instances of this line, PublicLibraryPaths.Add(SDKDirectory); causing compiler warnings because PublicLibraryPaths is obsolete in newer versions of Unreal Engine, so you can either replace each instance of this line with PublicAdditionalLibraries.Add(SDKDirectory); or with PublicSystemLibraries.Add(SDKDirectory);. Or you can even get rid of each instance of that line altogether.

Moving on to actual compiler errors, in GameLiftServerSDK.h, some of the include statements are incorrect. For example, #include "ModuleManager.h" should be #include "Modules/ModuleManager.h"

#include "DelegateCombinations.h" should be #include "Delegates/DelegateCombinations.h"

#include "AllowWindowsPlatformTypes.h" should be #include "Windows/AllowWindowsPlatformTypes.h"

"#include "HideWindowsPlatformTypes.h" should be #include "Windows/HideWindowsPlatformTypes.h"

Similarly in GameLiftServerSDK.cpp, the following include statement should be fixed,

#include "ModuleManager.h" should be #include "Modules/ModuleManager.h"

#include "IPluginManager.h" should be #include "Interfaces/IPluginManager.h"

There is also an include statement missing in GameLiftServerSDK.cpp, the include for its own header file. And this include statement has to be the very first include statement in this cpp file,

#include "GameLiftServerSDK.h"

Lastly, there is an include statement #include "Core.h" that may trigger a compiler warning related to IWYU, because it is not recommended to import monolithic header files, but I have not found a workaround for this.

I will update this post appropriately if I find anything new, but hope this helps people who are experiencing issues when trying to build the UE4 plugin for versions of Unreal Engine greater than 4.21.

asked 5 years ago922 views
4 Answers
0
Accepted Answer

@REDACTEDUSER

answered 5 years ago
0

Yeah, I can confirm this. I did something similar for my example project. Here is the commit with all changes for Server SDK. I skipped warnings fixes because they're not necessary for the demo, though important of course. Another point: I needed additional public definition otherwise project won't link.

You're welcome to explore my code or corresponding article if anyone interesting. It could be helpful too.

answered 5 years ago
0

Hey @REDACTEDUSER

PublicDefinitions.Add("USE_IMPORT_EXPORT");

I remember I needed this in the Yetitech client sdk a while ago but I am curious as to why you included this in the server sdk. What is the error that you get when you remove this line? And does this only happen when using both the server sdk and client sdk? Only asking because I don't seem to need this line when I use the server sdk alone.

But thanks for the project and article, I always meant to go back and fix my pull request to the yeti tech client sdk despite not using it anymore.

answered 5 years ago
0

Just wondering, did you add this line in the GameLiftServerSDK.Build.cs file?

Yes, you can see it in the commit.

What is the error that you get when you remove this line?

Linkage errors. Either not defined symbols or double defined symbols. If I not mistaken it was constructors of Aws::GameLift::Server::Model::GameSession. They're inlined and that's fine but somehow the Unreal Build system refuses to see them properly. It worked perfectly in UE4.22 (I had a project on the older version); I guess, they've changed something in the build system.

And does this only happen when using both the server sdk and client sdk?

No, It happened before I even started integrating Client SDK.


Exact error messages if I just comment out this public definition (I stripped my local paths):

2>aws-cpp-sdk-gamelift-server.lib(aws-cpp-sdk-gamelift-server.dll) : error LNK2005: "public: __cdecl Aws::GameLift::Server::Model::GameSession::~GameSession(void)" (??1GameSession@Model@Server@GameLift@Aws@@QEAA@XZ) already defined in GameLiftServerSDK.cpp.obj
2>aws-cpp-sdk-gamelift-server.lib(aws-cpp-sdk-gamelift-server.dll) : error LNK2005: "public: __cdecl Aws::GameLift::Server::Model::GameSession::GameSession(class Aws::GameLift::Server::Model::GameSession const &)" (??0GameSession@Model@Server@GameLift@Aws@@QEAA@AEBV01234@@Z) already defined in GameLiftServerSDK.cpp.obj
2>     Creating library <path>\UE4GameLift\Binaries\Win64\UE4GameLiftServer.lib and object <path>\UE4GameLift\Binaries\Win64\UE4GameLiftServer.exp
2><path>\UE4GameLift\Binaries\Win64\UE4GameLiftServer.exe : fatal error LNK1169: one or more multiply defined symbols found
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions