Search code examples
c++unreal-engine5

Cannot compile code of my Projet with Visual Studio 2022 and Unreal Engine 5


I recently installed Unreal Engine 5 with Visual Studio 2022. I need to create a Pawn Class: I tried from Unreal Engine Editor, which opened Visual Studio and cannot compile the code. It seems there is an issue with the version.

I tried to recreate a new project in UE5 with C++ as default in the creation page and I get a similar error.

Here is what I got when trying to create that C++ project in UE5.

Running C:/Program Files/Epic Games/UE_5.3/Engine/Build/BatchFiles/Build.bat Development Win64 -Project="C:/Users/Windows 11/Documents/Unreal Projects/ExplorationGameTest/ExplorationGameTest.uproject" -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
Using bundled DotNet SDK version: 6.0.302
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" Development Win64 -Project="C:/Users/Windows 11/Documents/Unreal Projects/ExplorationGameTest/ExplorationGameTest.uproject" -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
Log file: C:\Users\Windows 11\AppData\Local\UnrealBuildTool\Log.txt
Creating makefile for ExplorationGameTestEditor (no existing makefile)
@progress push 5%
Parsing headers for ExplorationGameTestEditor
  Running Internal UnrealHeaderTool "C:\Users\Windows 11\Documents\Unreal Projects\ExplorationGameTest\ExplorationGameTest.uproject" "C:\Users\Windows 11\Documents\Unreal Projects\ExplorationGameTest\Intermediate\Build\Win64\ExplorationGameTestEditor\Development\ExplorationGameTestEditor.uhtmanifest" -WarningsAsErrors -installed
Total of 0 written
Reflection code generated for ExplorationGameTestEditor in 0.6409217 seconds
@progress pop
Building ExplorationGameTestEditor...
Using Visual Studio 2022 14.39.33522 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519) and Windows 10.0.22000.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Determining max actions to execute in parallel (20 physical cores, 28 logical cores)
  Executing up to 20 processes, one per physical core
  Requested 1.5 GB memory per action, 18.41 GB available: limiting max parallel actions to 12
------ Building 6 action(s) started ------
[1/6] Resource Default.rc2
[2/6] Compile [x64] SharedPCH.Engine.Cpp20.cpp
C:\Program Files\Epic Games\UE_5.3\Engine\Source\predefined C++ types (compiler internal)(420): error C2248: 'FHazardPointerCollection::FHazardRecord::FHazardRecord'? impossible d'acc?der ? private membre d?clar?(e) dans la classe 'FHazardPointerCollection::FHazardRecord'
C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h(86): note: voir la d?claration de 'FHazardPointerCollection::FHazardRecord::FHazardRecord'
C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h(77): note: voir la d?claration de 'FHazardPointerCollection::FHazardRecord'
C:\Program Files\Epic Games\UE_5.3\Engine\Source\predefined C++ types (compiler internal)(420): note: le contexte d'instanciation du mod?le (le plus ancien) est
C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h(133): note: voir la r?f?rence ? l'instanciation de la fonction mod?le 'void __builtin_array_init_helper<FHazardPointerCollection::FHazardRecord>(_T *,size_t) noexcept(<expr>)' en cours de compilation
        with
        [
            _T=FHazardPointerCollection::FHazardRecord
        ]
Total time in Parallel executor: 8.79 seconds
Total execution time: 10.89 seconds

I tried to read it but could not understand what went wrong.

My attention went to this specific line

_T=FHazardPointerCollection::FHazardRecord

And I went to that subject : https://forums.unrealengine.com/t/failure-to-create-a-new-project-cannot-access-private-member-declared-in-class-fhazardpointercollection-fhazardrecord/1548295

I'm currently trying to install the package from that subject but I feel weird that the interaction between the last versions of UE5 and VS Community 2022 would be bugged.

Can you help me to understand and fix this?


Solution

  • It's fixed: installing the package mentionned in the UE forum thread above indeed fixed the issue that seems to be related to the new version of VS 2022 (17.9).

    Maybe this will help some? If not, tell me if the question has to be deleted, I'm new to stackoverflow :)