记录一次在使用Rider编译UE5.2源码时的报错以及解决方案
前言
最近因为项目需要,下载了UE5.2的源码,在使用Rider编译的过程中遇到了一些问题,这里记录我遇到的问题以及有效的解决方案。
编译环境
Windows 10
JetBrans Rider
Unreal Engine 5.2 源码
问题1:The SDK ‘Microsoft.NET.SDK.WorkloadAutoImportPropsLocator’ specified could not be found.
参考链接: Can’t build fresh proj on UE 5.3 on Rider
在使用UE5.2发行版时没有出现过该问题,但UE5.2源码版编译无法通过;
在使用UE5.3的发行版时也有出现该问题。
使用Rider无法编译,但使用Visual Studio可以正常编译。
解决方案:在Visual Studio Install中安装 .Net桌面开发,然后用Rider编译即可。
问题2:SteamVRInputDeviceFunctionLibrary.cpp(513): Error C4834 : 放弃具有 [[nodiscard]] 属性的函数的返回值
参考链接: Build from source fails with errors C4834 and MSB3073
解决方案:修改源码中SteamVRInputDeviceFunctionLIbrary.cpp中的513行
原代码:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, (TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));
修改为:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Unable to find Action [%s] for Action Set [%s]"), *ActionName.ToString(), *ActionSet.ToString()));
以上修改不会重新编译整个引擎,只会重新编译几个actions,可以放心改。