Error C4834 discarding return value of function with ‘nodiscard’ attribute
Fstring 的獲得指針的函數(shù)是 nodiscard 的,但是目前這個表達(dá)式是可能 discard 的
https://forums.unrealengine.com/t/build-from-source-fails-with-errors-c4834-and-msb3073/1266696/4
Windows SDK 的問題
我遇到的錯誤如下
Severity Code Description Project File Line Suppression State
Error C4668 '_NOEXCEPT_TYPES_SUPPORTED' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' UE4 C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt\wrl\event.h 211
Error C4668 '__cpp_noexcept_function_type' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' UE4 C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt\wrl\event.h 211
Error C4668 '_NOEXCEPT_TYPES_SUPPORTED' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' UE4 C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt\wrl\event.h 371
Error C4668 '__cpp_noexcept_function_type' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' UE4 C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt\wrl\event.h 371
Error MSB3073 The command "..\..\Build\BatchFiles\Build.bat -Target="UE4Editor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 6. UE4 E:\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets 44
這應(yīng)該是說明 10.0.22621.0 是不適用的
我在網(wǎng)上看到了別人的解決辦法是只保留 Win 10 的 SDK,不要 Win 11 的 SDK
https://zhuanlan.zhihu.com/p/584575858
因為我覺得直接修改所有項目要求的 Windows SDK 版本也是一樣的效果,所以一開始我沒有卸載 Win 11 的 SDK,然后企圖使用重定向的那個功能來更改版本
但是失敗了……即使點了確定,再次打開重定向窗口顯示的仍然是舊版本
上網(wǎng)看了,這個 VS 的 Bug 有一段時間了
vcxproj 也不是只讀的,所以應(yīng)該是 VS 內(nèi)部的問題
這個解決方案有七十多個項目,如果要一個一個去 vcxproj 里面改版本,那就累死……
于是我還是把 Win 11 的 SDK 刪了,這樣他就會默認(rèn)用我 Win 10 的
然后他說要重啟電腦,重新運行 Setup.bat 和 GenerateProjectFiles.bat,這個我沒有,我就可以直接開始 build UE4 項目了
花的時間還是很長的……
compiler heap 不足的問題
最后是能編譯,但是等了一個小時左右之后,報錯說 compiler heap 不足
一開始我想的是把虛擬內(nèi)存調(diào)大一點,但是我設(shè)置了之后沒有反應(yīng),于是我想查查別的方法
于是查到了
https://ue5wiki.com/wiki/5cc4f8a/文章來源:http://www.zghlxwxcb.cn/news/detail-729004.html
把工程中的 BuildConfiguration.xml 修改一下就好了文章來源地址http://www.zghlxwxcb.cn/news/detail-729004.html
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<WindowsPlatform>
<PCHMemoryAllocationFactor>1000</PCHMemoryAllocationFactor>
</WindowsPlatform>
<LocalExecutor>
<MaxProcessorCount>60</MaxProcessorCount>
</LocalExecutor>
<ParallelExecutor>
<MaxProcessorCount>60</MaxProcessorCount>
</ParallelExecutor>
</Configuration>
到了這里,關(guān)于UE4.27.2 源碼使用 VS2022 編譯時出現(xiàn)的錯誤的解決方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!