Also, I’ve checked in engine files like Source/Developer/SessionFrontend/Private/Widgets/Console/SSessionConsoleShortcutWindow.cpp and this is exactly the way Json objects are created.
These linker errors indicate that you’re using code declared somewhere (usually in a header file) but not defined anywhere (usually in a library i.e. unreal engine module). So I would think the only two possibilities are that you are somehow including outdated header files or you’re not linking to the right modules.
Are you using the default directory structure for your project?
Thanks very much for the response and the explanation (I’m still quite a noob with C++, so it helps a lot). I’m listing the steps I took below for clarity:
Checked out the latest version of the “promoted” branch from Github (i.e. fetch and reset --hard to be a perfect copy of upstream)
Ran setup.bat to download the latest dependencies
Generated the Visual Studio .sln file
Rebuilt the engine
Ran the engine executable
Created a new basic code C++ project
Added some classes (using default location) like MyPlayerController, MyPlayerCharacter etc.
Added the PublicDependency module as stated in the original post
In my GameMode class’ constructor added code as in original post, as well as #include “JsonObject.h” and “Json.h” - I’ve tried without these as well.
Do you think I might need to delete my whole Unreal Engine folder and start from scratch?
Unfortunately, I don’t have much experience with UE4 yet (just C++ experience) and have even less experience building the engine from scratch. I was just going through the questions and trying to add helpful input where I could.
Best of luck! I’m sure someone from Unreal would have a decent idea.
The solution is to include the Json and Json Utilities packages in YourGame.Build.cs:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class TestGame : ModuleRules
{
public TestGame(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore"});
// Add Json Modules
PublicDependencyModuleNames.AddRange(new string[] { "Json", "JsonUtilities" });
...
}
}
You must also REbuild your game for these new packages to be included. It seems like it rebuilds the engine as well though.