RunUAT.bat BuildPlugin - syntax error: identifier '{plugin_name}'

Hi,

I am trying to release an Unreal plugin named ‘Ariel’. To do this, the plugin must compile successfully using the RunUAT.bat script, as described in section 2.6.3b here

I don’t have any errors when I am building the plugin through the Unreal engine editor, however the build failed when I try to compile using the RunUAT.bat script and I don’t understand why…

The error comes from the plugin ‘main’ class generated by the unreal editor, or classes that are defined in the Unreal engine source files…

D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\Ariel.cpp(28): error C2061: syntax error: identifier 'Ariel'
C:\Program Files\UE_5.1\Engine\Source\Runtime\Online\HTTP\Public\Interfaces\IHttpBase.h(10): error C2143: syntax error: missing ';' before '<class-head>'
C:\Program Files\UE_5.1\Engine\Source\Runtime\Online\HTTP\Public\Interfaces\IHttpBase.h(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

It seems that there are also errors with the ‘FJsonObject’ and ‘TSharedPtr’ classes:

D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): error C2065: 'FJsonObject': undeclared identifier
D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): error C2923: 'TSharedPtr': 'FJsonObject' is not a valid template type argument for parameter 'ObjectType'
D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): note: see declaration of 'FJsonObject'
D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): error C2976: 'TSharedPtr': too few template arguments
C:\Program Files\UE_5.1\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h(669): note: see declaration of 'TSharedPtr'
D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): error C2061: syntax error: identifier 'FJsonObject'
D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): error C2672: 'MakeShareable': no matching overloaded function found
D:\temp\ARIEL_UE\HostProject\Plugins\Ariel\Source\Ariel\Private\ArielBPLibrary.cpp(25): error C2780: 'SharedPointerInternals::TRawPtrProxyWithDeleter<ObjectType,DeleterType> MakeShareable(ObjectType *,DeleterType &&)': expects 2 arguments - 1 provided

Do you have any idea how to fix these errors ? I tried multiple workarounds but sadly the errors remain…

Here is my plugin files:

Ariel.h:

#pragma once
#include "Modules/ModuleInterface.h"

class FArielModule : public IModuleInterface
{
public:

	/** IModuleInterface implementation */
	virtual void StartupModule() override;
	virtual void ShutdownModule() override;
};

Ariel.cpp:

#include "Ariel.h"

#define LOCTEXT_NAMESPACE "FArielModule"

void FArielModule::StartupModule() {}
void FArielModule::ShutdownModule() {}

#undef LOCTEXT_NAMESPACE
	
IMPLEMENT_MODULE(FArielModule, Ariel)

Ariel.build.cs:

using UnrealBuildTool;

public class Ariel : ModuleRules
{
	public Ariel(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
		
		PublicIncludePaths.AddRange(new string[] {});
		PrivateIncludePaths.AddRange(new string[] {});
		PublicDependencyModuleNames.AddRange(new string[] {
				"Core",
				"HTTP",
				"Json"
		});
		PrivateDependencyModuleNames.AddRange(new string[] {
				"CoreUObject",
				"Engine",
				"Slate",
				"SlateCore",	
		});
		DynamicallyLoadedModuleNames.AddRange(new string[]{});
	}
}

Ariel.uplugin:

{
	"EngineVersion": "5.1",
	"FileVersion": 3,
	"Version": 1,
	"VersionName": "1.0.4",
	"FriendlyName": "Ariel",
	"Description": "Ariel Text-To-Speech API plugin",
	"Category": "Other",
	"CreatedBy": "XandImmersion",
	"CreatedByURL": "https://xandimmersion.com",
	"DocsURL": "https://drive.google.com/file/d/1XQobsx9TpCQFhqnN0jxmNl8yAmjS2Lro/",
	"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/ff439820f18e463caf0b38400ebe8389",
	"SupportURL": "https://l.linklyhq.com/l/1fMJz",
	"CanContainContent": true,
	"IsBetaVersion": true,
	"IsExperimentalVersion": false,
	"Installed": false,
	"Modules": [
		{
			"Name": "Ariel",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"PlatformAllowList": [
				"Win64",
				"Mac",
				"Linux"
			]
		}
	]
}

Thank you for your help !

Hi xand449,

That document says you “can” use RunUAT.bat to compile - I don’t think it’s necessary - if it compiles and runs from VS, and you get the “package” button on your plugin, you should be good to go.

Something you could try though, is closing UE, making a change to your plugin source code without compiling, then opening your project - it should prompt, and then sucessfully compile your plugin.

Hi,

Thanks for your answer. In order to publish a plugin in the unreal marketplace, I need to send to epic my script files uncompiled (correct me if I’m wrong).

Then, they’ll use the RunUAT.bat on their side to check if the code provided can be compiled with the Epic’s compilation toolchain, which is more rigourous than others.

I tried to package my project by using the ‘Package’ button in Edit > Plugin > {Plugin name} > Package but sadly the same errors appear… Do you have other ideas ?

https://imgur.com/gnYGxpn

Okay I find out why the plugin wouldn’t compile.

With @RecourseDesign answer’s, I find a previous post here which says:

…Or this might be also some improper include. You said you place Engine.h in some file, Engine.h should be included in TestPluginPrivatePCH.h as a first include + if you include something else from engine it Engine.h is sometimes ingerented from there

That was it. I included Engine.h in the beginning of my Ariel.h header file and the build succeeded. I assume that this wasn’t a problem when compiling through the unreal editor because Engine.h was already added the linker by some other unreal script, but it wasn’t the case when packaging the plugin independently.

https://imgur.com/a/on8q0rL

It’s funny because my IDE (Jetbrain Rider) say that the include is unused but it’s not really the case.

2 Likes

Amazing. Been having this issue for like a month. I just added the #include “Engine.h” like you said and it worked!
No idea what it does or why I need it but hey, i dont care! Celebration time!

I encountered this problem lately and yes, including “Engine.h” works!

However, this spawns a warning message
Warning: Monolithic headers should not be used by this module. Please change it to explicitly include the headers it needs.

After lots of trials and errors I discovered, that the only header you need to include is actually:
Modules/ModuleManager.h (instead of ModuleInterface.h).