question

Cedric Neukirchen avatar image
Cedric Neukirchen asked

[UE4] Crossplatform SDK compile errors

Hello everyone,

a while ago I asked how to get the UE4 Plugin to work with Linux and co and I was greeted with the answer, that the UE4 plugin only supports Windows. Furthermore I was told to use the Crossplatfrom C++ SDK if I need Crossplatform support (for now Linux + Xbox).

Now that's all fine, however I'm pretty much lost as to how to get this all setup.
I think I managed to add the PlayFab part of the SDK to a new UE4 Plugin correctly.

Folder hierarchy looks like this at the moment, starting from the Project root:

- "Plugins\PlayFabXPlatform\Source\ThirdParty\PlayFabXPlatformLibrary\x64\Release\XPlatCppWindows\" holds the "XPlatCppWindows" .lib/.pch/.pdb
- "Plugins\PlayFabXPlatform\Source\ThirdParty\PlayFabXPlatformInclude\playfab\" is the "playfab" include folder with all the header files

Now "PlayFabJsonHeaders.h" requires multiple json headers. So I went ahead and moved them from the SDK folders to:

- "Plugins\PlayFabXPlatform\Source\ThirdParty\PlayFabXPlatformInclude\json\"

Now after all of this, I receive "unresolved external symbole" errors for all sorts of json functions when trying to compile.
Which kinda makes sense, as I never included any json library. So I went ahead and performed the same steps I used to link the playfab library now for the json one. Sadly this doesn't seem to fix the errors at all.

Does anyone have a quick guide for me how to set this up? Once I can use the Crossplatform SDK (so once it's properly linked) I should be good to go for a while.

Thanks in advance and cheers!

PS: If you need my build.cs code just let me know.

sdksunrealwindowssupport
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

franklinchen avatar image
franklinchen answered

Hi @Cedric Neukirchen,

We have seen several questions on this CPP SDK, you can see this answer and have a try: https://community.playfab.com/answers/28850/view.html

With these steps, we can fix the linking, json lib and header issues.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cedric Neukirchen avatar image
Cedric Neukirchen answered

Heyho, I came back to this problem yesterday and finally managed to get this to compile. And boy was it a journey.

So if you want to have the SDK compile in your UE4 Plugin, you'll have to first download the SDK from GitHub, + the external Json C++ Library. Once that is all downloaded, you'll want to head to the Build/Windows folder and open the sln file. Packaging it apparently for Debug x64 AND Release x64.
Why? Because I had to use the Debug lib version of Json and the Release version of Playfab.
Otherwise it would cause debug_levels to be different, which obviously makes no sense, but heeeyyy.

Now when having build the SDK and gathered the lib for playfab and lib_json, you will want to move these to your desired folder structure in your plugin. Mine sit somewhere in Source/ThirdParty/Libraries...

Since the libraries only take over the cpp part of the SDK, you'll have to also include playfab's and json's header files, which you can find in either include folder inside the SDK.
Mine were then placed in Source/ThirdParty/Includes/playfab as well as Source/ThirdParty/Includes/json.

Not 100% sure anymore if I had to change the include paths in the JsonHeader file of playfab, but you'll notice if it cries about the files not being found.

Now the main part, even if you manage to do this all and you are sure you have everything in place and loaded via the build.cs, you will most likely still run into external symbols missing when trying to use the default example for using the SDK (check docs).

Why is that? Because the json library that playfab utilizes is expecting its API macro (JSON_API) to be undefined in whatever project you are adding this to.
Now what would UE4 be without its own Json Module, which of course defines JSON_API.
The solution to the external symbols (given you have included the json lib properly via build.cs) is to go through the few json headers of the external library and rename JSON_API to something else, e.g. JSON_PF_API.

And that's it, then it will compile properly. I can give more information if needed. Hope it helps another lost soul.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matthew Williams avatar image Matthew Williams commented ·

hey man, i too have just seen that i cannot get playfab to work on Linux, and if you have it working, i would love to hear from you, i am the only dev working on this for my game and completely lost. I also use UE4 plugin as well, so any help would be appriciated :)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.