UE5.8: Error occurs when creating a C++ project

Compile [x64] SharedPCH.UnrealEd.Project.ValApi.ValExpApi.Cpp20.cpp
E:\UE_5.8\Engine\Source\Runtime\Core\Public\Containers\ContainerAllocationPolicies.h(843,3): error C7539: ‘ForAnyElementType’: a class with user-declared constructors cannot have a member with the same name as the class
using SuperClass::ForAnyElementType::ForAnyElementType;
^
E:\UE_5.8\Engine\Source\Runtime\Core\Public\Containers\ContainerAllocationPolicies.h(843,3): note: the template instantiation context (the oldest one first) is
E:\UE_5.8\Engine\Source\Runtime\Core\Public\Containers\ContainerAllocationPolicies.h(918,2): note: see reference to class template instantiation ‘TSizedHeapAllocator<IndexSize,BaseMallocType>’ being compiled
};
^
E:\UE_5.8\Engine\Source\Runtime\Core\Public\Containers\ContainerAllocationPolicies.h(898,1): note: see reference to class template instantiation ‘TSizedHeapAllocator<IndexSize,BaseMallocType>::ForAnyElementType’ being compiled
BaseMalloc::Free(InData);

Same error

I fixed it by downloading VS 2026 and build tool v14.50

+1 for downloading VS 2026 and build tools 14.50 on Windows 11.

If you previously tried building your project with VS 2022 like I did, don’t forget to regenerate your project files or the build process might still use the VS 2022 pipeline. I deleted the old .sln file first, but I don’t know if that was strictly necessary. For reference, regenerate by:

  • right clicking the .uproject file in Windows Explorer
  • click Show More Options
  • click Generate Visual Studio project files.