C++ Transition Guide for 5.4

Dear Community,

Here is a thread where you can post any issues you are encountering while upgrading to UE 5.4!

:heart: Yay for UE 5.4! :heart:

Thank You :heart: Epic! :heart:

Release Notes


VS 2022 x64 Issues

:heart:

Rama

8 Likes

bStrictConformanceMode

“[ProjectName] modifies the values of properties: [ bStrictConformanceMode ]. This is not allowed, as [ProjectName] has build products in common with UnrealEditor.”


Original

using UnrealBuildTool;
using System.Collections.Generic;

public class PMeleeWeaponEditorTarget : TargetRules
{
	public PMeleeWeaponEditorTarget(TargetInfo Target) : base(Target)
	{
		        Type = TargetType.Editor;
                ExtraModuleNames.Add("PMeleeWeapon");
    }
}

Solution ~~> bOverrideBuildEnvironment = true

using UnrealBuildTool;
using System.Collections.Generic;

public class PMeleeWeaponEditorTarget : TargetRules
{
	public PMeleeWeaponEditorTarget(TargetInfo Target) : base(Target)
	{
                bOverrideBuildEnvironment = true;
		         Type = TargetType.Editor;
                ExtraModuleNames.Add("PMeleeWeapon");
    }
}

:heart:

Rama

7 Likes

I am having an issue with AutomationSpec Tests. When I try and load a test level using:

FAutomationEditorCommonUtils::LoadMap(TestWorldPath);

And I try to run my tests in the editor, before the map opens the engine crashes and in my IDE this error is printed in the logs:

appError called: Assertion failed: !LevelList.Contains(TickTaskLevel) [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp] [Line: 1458]

I was having a similar problem in 5.3.2 when my tests would try to reload the map I had open already, and I resolved by checking to see if that map was open already. Now it’s doing it regardless of what map is already loaded, but it’s also inconsistent and doesn’t happen every time.

This doesn’t seem to be a problem when I use the normal test workflow with the latent command FEditorLoadMap(TestWorldPath)

I tried stepping through to see if I could identify where it goes wrong but it didn’t shed any light.

1 Like

error C2248: ‘TMemoryWriterBase<TSizedDefaultAllocator<32>>::IndexSize’: cannot access private member

Original

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;
using System.Collections.Generic;

public class PMeleeWeaponTarget : TargetRules
{
	public PMeleeWeaponTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Game;
		bUsesSteam = true;
        ExtraModuleNames.Add("PMeleeWeapon");
    }
}

Solution ~~~> DefaultBuildSettings = BuildSettingsVersion.Latest;

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;
using System.Collections.Generic;

public class PMeleeWeaponTarget : TargetRules
{
	public PMeleeWeaponTarget(TargetInfo Target) : base(Target)
	{
        DefaultBuildSettings = BuildSettingsVersion.Latest;
		Type = TargetType.Game;
		bUsesSteam = true;
        ExtraModuleNames.Add("PMeleeWeapon");
    }
}

Make sure to include this line

DefaultBuildSettings = BuildSettingsVersion.Latest;

in

[YourProject].target.cs

and

[YourProject]Editor.target.cs

and perform a full Re-Build <~~~

Also, make sure to remove any other values of DefaultBuildSettings, such as

DefaultBuildSettings = BuildSettingsVersion.V2; <~~~ Remove

:heart:

Rama

2 Likes

FQuat Header

error C2079: ‘FMeleeSweepData::Rotation' uses undefined struct 'UE::Math::TQuat<double>

Solution:
#include "Math/Quat.h"


FHitResult Moved From EngineTypes.h to HitResult.h

#include "Engine/EngineTypes.h"

Becomes

#include "Engine/HitResult.h"

:heart:

Rama

2 Likes

@Rama

Do you know anything about chaos cloth?

Here is my original post

1 Like

Howdy,

Having issues building my game since the upgrade was working fine in the latest 5.3 but now im getting un unresolved external symbol which normally means there is a missing dependency. From what i can see however nothing has changed for this, from 5.3 to 5.4 its still part of the CoreUObject Module.

Error : LNK2019: unresolved external symbol "__declspec(dllimport) public: class FString __cdecl FUniqueNetIdWrapper::ToString(void)const " (__imp_?ToString@FUniqueNetIdWrapper@@QEBA?AVFString@@XZ) referenced in function

My Build.cs
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "OnlineSubsystem", "OnlineSubsystemUtils"});

This line is the culprit, doesnt any one know if anythign has chnage if so what Module i need to add or a different way to get the UniqueID

PlayerController->PlayerState->GetUniqueId().ToString()

1 Like

I have a C++ project that I’m upgrading from UE5.3 to UE5.4. Its not compiled from source, just using factory fresh UE5.4

When compiling my project, I’m getting:

UE_5.4\Engine\Source\Runtime\Experimental\Chaos\Public\Chaos\ImplicitObjectScaled.h(1129): error C2760: syntax error: ‘const’ was unexpected here; expected ‘expression’

Its coming from this function inside ImplicitObjectScaled.h:

template<typename T>
const T* UnwrapImplicit(const FImplicitObject& Implicit, FVec3& OutScale, FReal &OutMargin)
{
	OutScale = FVec3(1);
	OutMargin = FReal(0);

	if (const TImplicitObjectScaled<T>* ScaledImplicit = Implicit.template GetObject<TImplicitObjectScaled<T>>())
	{
		OutScale = ScaledImplicit->GetScale();
		OutMargin = ScaledImplicit->GetMargin();
		return ScaledImplicit->GetUnscaledObject();
	}
	else if (const TImplicitObjectInstanced<T>* InstancedImplicit = Implicit.template GetObject<TImplicitObjectInstanced<T>>())
	{
		OutMargin = InstancedImplicit->GetMargin();
		return InstancedImplicit->GetInstancedObject();
	}
	else if (const T* RawImplicit = Implicit.template GetObject<T>())
	{
		OutMargin = RawImplicit->GetMargin();
		return RawImplicit;
	}
	else
	{
		return nullptr;
	}
}

Not sure how to get around this or why it would be failing to compile this?

Bloody hell!

PlayerState->GetUniqueId().ToString()
PlayerState->GetUniqueId()->ToString()

4 Likes

I thought I would include here what I found. In my project, after making the above target.cs changes plus adding in the following to build.cs, I still received errors.

Into build.cs
CppStandard = CppStandardVersion.Cpp20;

The remaining errors were for lack of include files that had not given me problems prior to 5.4.1. The error was like: invalid application of ‘sizeof’ casts.h

The error called out casts for 3 of my classes and UGameInstance. This error didn’t point back into any of my code, but by searching for where I had done Casts of the types mentioned in the error, I was able to find the files that lacked includes and add the includes in. All had been defined with the class statement and apparently no longer could be resolved. They had all worked fine prior to 5.4.1.

If you have many returns from a search for the casted class (e.g., search for

Cast<TheUnresolvedClass>(somepointer);

It takes quite a bit of time to find the instances that are actually causing the problem but eventually I was able to get rid of all of them.

This was on Mac and XCode and I’m guessing such a glaring issue would not have been present on more tested windows and VC versions without something mentioned in the release notes. In each case, it was where I’d used a class rather than include, though not all class statements caused the problem, just 4 out of 20 or 30.

Hi, is there any logic or reason behind changing the main editors Tool Menu first section name from “Tools” to “Instrumentation”?
It doesn’t have an access point either:

I’m kind of getting the impression that it’s not really wanting to be added to, in which case - do you think it would be too cheeky to add a tools submenu above that in the Programming section?

image

My code no longer compiles under Visual Studio (but it does via Clang on Linux). Specifically, because a library that I use takes the address of some temporaries, I pass in the following arguments:

bOverrideBuildEnvironment = true;

if (Target.Platform == UnrealTargetPlatform.Win64)
    AdditionalCompilerArguments = "/permissive /Zc:hiddenFriend /wd4018 /wd4238 /wd4458 /wd4576";

If I compile the 5.3 version of my project w/ Visual Studio (tried both latest MSVC and 14.38-17.8), this works fine, and if I compile the 5.4 version on Linux, it also works fine. Otherwise, however, I get C++ compliance errors for taking the address of temporaries. The other warnings seem to disable just fine, but the permissive C++ compliance doesn’t seem to go through. I also tried setting the BuildSettings to V4, and that didn’t fix it either. I am using the pre-built version of Unreal 5.4.1.

UPD Solution - its required to override GetInstanceMemorySize/InitializeMemory/CleanupMemory to inherit from BTCompositeNode in UE5.4, after that commit

On UE5.3 same code works fine

Logs

CONSOLE: Use build tool: C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe
17:03:04 Building S:\Epic Games\UE_5.4\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj
17:03:04 Building S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Build\EpicGames.Build.csproj
17:03:04 Building S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj






17:03:04 Building S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.MsBuild\EpicGames.MsBuild.csproj
17:03:04 Building S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Oodle\EpicGames.Oodle.csproj
EpicGames.Core → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Core\bin\Development\net6.0\EpicGames.Core.dll
EpicGames.IoHash → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.IoHash\bin\Development\net6.0\EpicGames.IoHash.dll
EpicGames.MsBuild → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.MsBuild\bin\Development\net6.0\EpicGames.MsBuild.dll


EpicGames.Oodle → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Oodle\bin\Development\net6.0\EpicGames.Oodle.dll
EpicGames.Serialization → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Serialization\bin\Development\net6.0\EpicGames.Serialization.dll
EpicGames.Horde → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.Horde\bin\Development\net6.0\EpicGames.Horde.dll
EpicGames.UBA → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.UBA\bin\Development\net6.0\EpicGames.UBA.dll
EpicGames.UHT → S:\Epic Games\UE_5.4\Engine\Source\Programs\Shared\EpicGames.UHT\bin\Development\net6.0\EpicGames.UHT.dll



Using bundled DotNet SDK version: 6.0.302
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” UE5_4__TestCPPWorksEditor Win64 Development -Project=“S:\UE5_4__TestCPPWorks\UE5_4__TestCPPWorks.uproject” -WaitMutex -FromMsBuild -architecture=x64
Log file: C:\Users\Ciber\AppData\Local\UnrealBuildTool\Log.txt
Invalidating makefile for UE5_4__TestCPPWorksEditor (UE5_4__TestCPPWorks.Build.cs modified)
Parsing headers for UE5_4__TestCPPWorksEditor
Running Internal UnrealHeaderTool S:\UE5_4__TestCPPWorks\UE5_4__TestCPPWorks.uproject S:\UE5_4__TestCPPWorks\Intermediate\Build\Win64\UE5_4__TestCPPWorksEditor\Development\UE5_4__TestCPPWorksEditor.uhtmanifest -WarningsAsErrors -installed
Total of 0 written
Reflection code generated for UE5_4__TestCPPWorksEditor in 0.869413 seconds
Building UE5_4__TestCPPWorksEditor…
Using Visual Studio 2022 14.38.33134 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Determining max actions to execute in parallel (12 physical cores, 24 logical cores)
Executing up to 12 processes, one per physical core
Requested 1.5 GB memory per action, 5.75 GB available: limiting max parallel actions to 3
Using Parallel executor to run 5 action(s)
------ Building 5 action(s) started ------
[1/5] Compile [x64] BTComposite_RandomSelector.gen.cpp
[2/5] Compile [x64] BTComposite_RandomSelector.cpp
[3/5] Link [x64] UnrealEditor-UE5_4__TestCPPWorks.lib
Creating library S:\UE5_4__TestCPPWorks\Intermediate\Build\Win64\x64\UnrealEditor\Development\UE5_4__TestCPPWorks\UnrealEditor-UE5_4__TestCPPWorks.lib and object S:\UE5_4__TestCPPWorks\Intermediate\Build\Win64\x64\UnrealEditor\Development\UE5_4__TestCPPWorks\UnrealEditor-UE5_4__TestCPPWorks.exp
[4/5] Link [x64] UnrealEditor-UE5_4__TestCPPWorks.dll
Creating library S:\UE5_4__TestCPPWorks\Intermediate\Build\Win64\x64\UnrealEditor\Development\UE5_4__TestCPPWorks\UnrealEditor-UE5_4__TestCPPWorks.sup.lib and object S:\UE5_4__TestCPPWorks\Intermediate\Build\Win64\x64\UnrealEditor\Development\UE5_4__TestCPPWorks\UnrealEditor-UE5_4__TestCPPWorks.sup.exp
11>BTComposite_RandomSelector.gen.cpp.obj: Error LNK2001 : unresolved external symbol "public: virtual void __cdecl UBTCompositeNode::InitializeMemory(class UBehaviorTreeComponent &,unsigned char *,enum EBTMemoryInit::Type)const " (?InitializeMemory@UBTCompositeNode@@UEBAXAEAVUBehaviorTreeComponent@@PEAEW4Type@EBTMemoryInit@@@Z)
11>BTComposite_RandomSelector.gen.cpp.obj: Error LNK2001 : unresolved external symbol "public: virtual void __cdecl UBTCompositeNode::CleanupMemory(class UBehaviorTreeComponent &,unsigned char *,enum EBTMemoryClear::Type)const " (?CleanupMemory@UBTCompositeNode@@UEBAXAEAVUBehaviorTreeComponent@@PEAEW4Type@EBTMemoryClear@@@Z)
11>UnrealEditor-UE5_4__TestCPPWorks.dll: Error LNK1120 : 2 unresolved externals
Total time in Parallel executor: 2.15 seconds
Total execution time: 5.00 seconds
11>Microsoft.MakeFile.Targets(44,5): Error MSB3073 : The command ““S:\Epic Games\UE_5.4\Engine\Build\BatchFiles\Build.bat” UE5_4__TestCPPWorksEditor Win64 Development -Project=“S:\UE5_4__TestCPPWorks\UE5_4__TestCPPWorks.uproject” -WaitMutex -FromMsBuild -architecture=x64” exited with code 6.

P.S.
Probably that commit broke possibility to inherit but can’t get how
https://github.com/EpicGames/UnrealEngine/commit/30ab10cfa6697944af0e3260f36bc00e682fa6a5

2 Likes

Anyone else gets the:

Error C4702 : unreachable code

It’s super annoying. I often return code instead of commenting out the lines after. I think the compiler will strip it away anyway and it’s just a warning which UE promotes to an error.
Can I somehow disable it everywhere?

For now I just disabled it in the relevant headers above the includes with:

#pragma warning(disable: 4702)

add this to your editor/game/client etc. target file and this should disable all 4702 warning/error

        bOverrideBuildEnvironment = true;
        AdditionalCompilerArguments += "/wd4702";

ps: if you compile things for linux os as well, linux doesnt need this. so this is a “better” way probably:

		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
			bOverrideBuildEnvironment = true;
			AdditionalCompilerArguments += "/wd4702";
		}
1 Like

Engine\Source\Runtime\Core\Public\Containers\Map.h(1031) : error C4702 When Compile with “Debug Game Editor” Config.

The message above yours has the solution :slight_smile: you can also remove all unused code instead. (Had the same problem)

@AmphDev Thanks!

1 Like

Hi! Does anybody know how can be fixed following error?

0>Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" TacticalEditor Win64 DebugGame -Project="C:\Projects\Tactical\Tactical.uproject" -WaitMutex
0>Log file: C:\Users\Fenyx\AppData\Local\UnrealBuildTool\Log.txt
0>Using 'git status' to determine working set for adaptive non-unity build (C:\Projects\Tactical).
0>Invalidating makefile for TacticalEditor (working set of source files changed)
0>Warning: C:\Projects\Tactical\Tactical.uproject does not list plugin 'MovieRenderPipeline' as a dependency, but module 'Tactical' depends on 'MovieRenderPipelineCore'.
0>Parsing headers for TacticalEditor
0>  Running Internal UnrealHeaderTool C:\Projects\Tactical\Tactical.uproject C:\Projects\Tactical\Intermediate\Build\Win64\TacticalEditor\DebugGame\TacticalEditor.uhtmanifest -WarningsAsErrors -installed
0>Total of 0 written
0>Reflection code generated for TacticalEditor in 4.1207242 seconds
0>Building TacticalEditor...
0>Using Visual Studio 2022 14.38.33138 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10).
0>[Upgrade]
0>[Upgrade] Using backward-compatible include order. The latest version of UE has changed the order of includes, which may require code changes. The current setting is:
0>[Upgrade]     IncludeOrderVersion = EngineIncludeOrderVersion.Oldest
0>[Upgrade] Suppress this message by setting 'IncludeOrderVersion = EngineIncludeOrderVersion.Latest;' in TacticalEditor.Target.cs.
0>[Upgrade] Alternatively you can set this to 'EngineIncludeOrderVersion.Latest' to always use the latest include order. This will potentially cause compile errors when integrating new versions of the engine.
0>[Upgrade]
0>[Adaptive Build] Excluded from Tactical unity file: GlobalMapParty.cpp, TacticalCharacter.cpp, TacticalCharacterPlayer.cpp, NearestEnemyPlayerContext.cpp, CharacterAttributesComponent.cpp, EquipmentComponent.cpp, PartyAttributesComponent.cpp, CharacterAttributes.cpp, TacticalBattleAiManager.cpp, TacticalBattleManager.cpp, BaseArmor.cpp, Placeable.cpp, TrainningYard.cpp
0>Determining max actions to execute in parallel (12 physical cores, 16 logical cores)
0>  Executing up to 12 processes, one per physical core
0>  Requested 1.5 GB memory per action, 2.2 GB available: limiting max parallel actions to 1
0>Using Parallel executor to run 9 action(s)
0>------ Building 9 action(s) started ------
0>[1/9] Compile [x64] Module.Tactical.20.cpp
0>[2/9] Compile [x64] Module.Tactical.21.cpp
0>[3/9] Compile [x64] Module.Tactical.22.cpp
0>ImplicitObjectScaled.h(1129): Error C2760 : syntax error: 'const' was unexpected here; expected 'expression'
0>ImplicitObjectScaled.h(1129): Reference  : error recovery skipped: 'const'
0>ImplicitObjectScaled.h(1129): Error C2065 : 'ScaledImplicit': undeclared identifier
0>ImplicitObjectScaled.h(1129): Error C2903 : 'GetObjectW': symbol is neither a class template nor a function template
0>ImplicitObjectScaled.h(1129): Error C3878 : syntax error: unexpected token '(' following 'expression'
0>ImplicitObjectScaled.h(1129): Reference  : error recovery skipped: '('
0>ImplicitObjectScaled.h(1129): Error C2760 : syntax error: ')' was unexpected here; expected 'statement'
0>ImplicitObjectScaled.h(1129): Error C3878 : syntax error: unexpected token ')' following 'selection_statement'
0>ImplicitObjectScaled.h(1129): Reference  : error recovery skipped: ')'
0>ImplicitObjectScaled.h(1131): Error C2065 : 'ScaledImplicit': undeclared identifier
0>ImplicitObjectScaled.h(1132): Error C2065 : 'ScaledImplicit': undeclared identifier
0>ImplicitObjectScaled.h(1133): Error C2065 : 'ScaledImplicit': undeclared identifier
0>ImplicitObjectScaled.h(1135): Error C3878 : syntax error: unexpected token 'else' following 'statement_seq'
0>ImplicitObjectScaled.h(1135): Reference  : missing one of:  '}' ?
0>ImplicitObjectScaled.h(1135): Reference  : error recovery skipped: 'else if (  . . . ;'
0>ImplicitObjectScaled.h(1139): Reference  : parsing resumes here
type or paste code here

It’s a last one migration issue and have no clue how to fix it :*(

1 Like

Hey, did you figure this out? ran into the same issue. thanks!

yep

UPD Solution - its required to override GetInstanceMemorySize/InitializeMemory/CleanupMemory to inherit from BTCompositeNode in UE5.4, after that commit

even if no custom memory required you should override those methods to work

1 Like