Can't compile UE5.4

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?

Greetings @Trandana

I did some research on this issue(There was quite a bit on Error C2760) and there are a few causes for this. However, I’d start by ensuring all of your VS(Visual Studio) versions are up to date. If not, update them and try compiling again. Let me know how it goes.

1 Like

Thanks for the reply.

I was using VS 2022, using the MSVC v143 2022 compiler v 14.39

After fumbling around with different compiler version, I found this error during a compile:

UnrealBuildTool has banned the MSVC 14.39.33519-14.39.99999 toolchains due to compiler issues. Please install a different toolchain such as 14.38.33130 by opening the generated solution and installing recommended components or from the Visual Studio installer.

So I installed 14.31 as per this thread: UnrealBuildTool has banned the MSVC toolchain but I still get the error.

okay installing this one
image

seemed to do the trick

Oh, right on! I’m glad to see that you were able to resolve it! Have a great week!