ReubenW / Narrative

Repo for the Narrative Quest and Dialogue editor, current just used for tracking issues.
2 stars 0 forks source link

Unable to compile 4.27 & 5.0 C++ based projects. #8

Open KamikazeXeX opened 2 years ago

KamikazeXeX commented 2 years ago

Hey, I'm unable to compile our C++ project after adding a fresh copy from the Marketplace, there appears to be a good handful of code errors which are noted in the logs below, the latest UE5 version has these errors too though there's a few additional issues preventing projects from compiling.

Setup: C++ based project Engine: 4.27 + 5.0 (Binary builds from Epic Launcher) IDE: JetBrains Rider (VS 2019 also throws the same errors) MSVC: 14.29.30133 Windows 10 SDK: 10.0.18362.0

NOTE: I am copying the plugin into the project's "Plugins" folder (since it's a collaborative version controlled project with multiple developers and manually re-distributing the plugin is not a suitable solution)

UE 4.27 logs:

<ProjectPath>\Plugins\Narrative\Source\Narrative/Public/DialogueAsset.h(40): error C2065: 'FEditedDocumentInfo': undeclared identifier [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
<ProjectPath>\Plugins\Narrative\Source\Narrative/Public/DialogueAsset.h(40): error C2923: 'TArray': 'FEditedDocumentInfo' is not a valid template type argument for parameter 'InElementType' [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
    <ProjectPath>\Plugins\Narrative\Source\Narrative/Public/DialogueAsset.h(40): note: see declaration of 'FEditedDocumentInfo'
<ProjectPath>\Plugins\Narrative\Source\Narrative/Public/DialogueAsset.h(40): error C2976: 'TArray': too few template arguments [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
    U:\Unreal\Engines\UE_4.27\Engine\Source\Runtime\Core\Public\Containers/Array.h(306): note: see declaration of 'TArray'
<ProjectPath>/Plugins/Narrative/Intermediate/Build/Win64/UE4Editor/Inc/Narrative/DialogueAsset.gen.cpp(229): error C2512: 'TArray': no appropriate default constructor available [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
    U:\Unreal\Engines\UE_4.27\Engine\Source\Runtime\Core\Public\Containers/Array.h(306): note: see declaration of 'TArray'

UE 5.0 logs:

<ProjectPath>\Plugins\Narrative\Source\Narrative\Public\DialogueAsset.h(34): error C2065: 'FEditedDocumentInfo': undeclared identifier [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
<ProjectPath>\Plugins\Narrative\Source\Narrative\Public\DialogueAsset.h(34): error C2923: 'TArray': 'FEditedDocumentInfo' is not a valid template type argument for parameter 'InElementType' [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
  <ProjectPath>\Plugins\Narrative\Source\Narrative\Public\DialogueAsset.h(34): note: see declaration of 'FEditedDocumentInfo'
<ProjectPath>\Plugins\Narrative\Source\Narrative\Public\DialogueAsset.h(34): error C2976: 'TArray': too few template arguments [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
  U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\Core\Public\Containers\Array.h(311): note: see declaration of 'TArray'
<ProjectPath>\Plugins\Narrative\Source\Narrative\Public\DialogueAsset.h(34): error C2955: 'TArray': use of class template requires template argument list [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
  U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\Core\Public\Containers\Array.h(311): note: see declaration of 'TArray'
<ProjectPath>\Plugins\Narrative\Source\NarrativeDialogueEditor\Private\AssetTypeActions_DialogueAsset.cpp(38): error C2027: use of undefined type 'FMenuBuilder' [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
  U:\Unreal\Engines\UE_5.0\Engine\Source\Editor\BlueprintGraph\Classes\EdGraphSchema_K2.h(19): note: see declaration of 'FMenuBuilder'
  [10/18] Compile Module.NarrativeQuestEditor.cpp
U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\SlateCore\Public\Widgets\DeclarativeSyntaxSupport.h(924): error C2027: use of undefined type 'SButton' [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
  U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\Slate\Public\Widgets\Views\SExpanderArrow.h(15): note: see declaration of 'SButton'
  <ProjectPath>\Plugins\Narrative\Source\NarrativeQuestEditor\Private\QuestEditorDetails.cpp(104): note: see reference to class template instantiation 'TSlateDecl<SButton,RequiredArgs::T0RequiredArgs>' being compiled
U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\SlateCore\Public\Widgets\DeclarativeSyntaxSupport.h(924): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\SlateCore\Public\Widgets\DeclarativeSyntaxSupport.h(924): error C2143: syntax error: missing ',' before '&' [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
<ProjectPath>\Plugins\Narrative\Source\NarrativeQuestEditor\Private\QuestEditorDetails.cpp(104): error C2027: use of undefined type 'SButton' [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
  U:\Unreal\Engines\UE_5.0\Engine\Source\Runtime\Slate\Public\Widgets\Views\SExpanderArrow.h(15): note: see declaration of 'SButton'
<ProjectPath>\Plugins\Narrative\Source\NarrativeQuestEditor\Private\QuestEditorDetails.cpp(104): error C3861: 'FArguments': identifier not found [<ProjectPath>\Intermediate\ProjectFiles\TOO.vcxproj]
KamikazeXeX commented 2 years ago

Okay, so I've found the issue, it seems Narrative cannot currently be used in conjunction with projects that use non-unity compilation, as soon as I comment the following in my Project.Target.cs files, everything compiles successfully.

bUseUnityBuild = false;
bUsePCHFiles = false;

A more in-depth explanation from a former Epic staff member on the forum explaining why it's potentially important here: https://forums.unrealengine.com/t/how-to-compile-in-non-unity-mode/94863/5

This would be perfectly fine in a non-multi user project, but when there's 2 or more people working on a project and a headless build server ontop of that, things can get dicey if UBT decides to append different cpp files in different orders each time (and let's face it, not everyone has projects that've followed the correct C++ programming conventions/standards).