Tons of type has already been defined errors after upgrading source to 5.3.2

I’ve recently grabbed UnrealEngine-5.3.2-release from github and am getting a ton of errors related to core engine code. Lots of types already defined errors. It’s not just a couple files that are missing #pragma once, it’s something systemic, but I haven’t the foggiest clue.

I wiped the Intermediate and Saved folders to be safe, did a clean/rebuild, force synced everything from my perforce depot, etc. I originally tried compiling in VS 2022, and then in 2019, and got the same thing. I’ve never seen anything like this with an engine upgrade.

Here’s a small sample of the errors I’m seeing (paths edited to remove project name):

UnrealEngine\Engine\Source\Runtime\Core\Public\Templates\MemoryOps.h(29): error C2953: 'UE::Core::Private::MemoryOps::TCanBitwiseRelocate': class template has already been defined

UnrealEngine\Engine\Source\Runtime\Core\Public\Templates\MemoryOps.h(39): error C2995: 'void DefaultConstructItems(void *,SizeType)': function template has already been defined
UnrealEngine\Engine\Source\Runtime\Core\Public\Templates\MemoryOps.h(39): note: see declaration of 'DefaultConstructItems'

UnrealEngine\Engine\Source\Runtime\Core\Public\Misc\Fork.h(16): error C2011: 'EForkProcessRole': 'unsigned enum' type redefinition

Any ideas?

1 Like

Strange because looking though the source TCanBitwiseRelocate in memoryOps .h is actually defined in a different line (tempate definition is broken up on line 17 - 18)

Both files have #pragma once

These are from source (5.3.2)
MemoryOps.h (7.4 KB)

Fork.h (4.9 KB)

Did you do a clean download of the source code? (into an empty directory), pulled in the extra dependencies and build the solution correctly?

So that error is mentioning line 29 because that’s the line of the end of the struct definition (17-29). That file is identical for me to the one that you attached.

My process was per usual when doing an engine upgrade with perforce - I downloaded the source, deleted all from my current local engine depot directory, copied the new Engine files in, then ran a “reconcile offline work”, then submitted the changes.

I have my game project setup with a different perforce stream, so there’s an engine stream and a game project stream, the game project stream imports a branch of the engine stream. So I did have to merge in the new 5.3.2 source, and then I deleted the game’s engine directory and ran a force sync for the engine stream. And then finally ran the Setup.bat, which succeeded.

I’m guessing something got messed up during the merge step…

So I’ve discovered that Debug Game compiles fine…something wrong with the editor setup.

I’ve tested this with a fresh download of 5.3.2 and 5.3.0 as well, same thing. Is something messed up with my visual studio environment? I installed VS 2022 to use that originally and then back to 2019, same errors for both. I’m at a loss as to what this might be.

Get rid of vs 2019 if its not critical. Having both can cause problems.

Well, that didn’t do anything. Any other ideas would be welcome! I’m about to wipe my drive at this point.

Finally figured it out. The game’s editor.target.cs needed to be updated:

		Type = TargetType.Editor;
// 		IntermediateEnvironment = UnrealIntermediateEnvironment.IWYU;
//      bEnforceIWYU = true;
		DefaultBuildSettings = BuildSettingsVersion.V4;
		IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_3;

Previously it was BuildSettingsVeresion.V2 and didn’t have the EngineIncludeOrderVersion added.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.