Failure to create a new project: "cannot access private member declared in class 'FHazardPointerCollection::FHazardRecord'"

Hi, I’ve never worked with UE before, just installed UE 5.3.2. Trying to create a new project, I select “Games” - “First person”, then I select C++/Desktop/Scalable quality. I also ticked “Starter content”, and no raytracing. Now click “Create” - it works for a while and throws this compilation error.

Any advice?

6 Likes

Getting this as well. Wish Epic tested their software before publishing it.

Hello I have been experiencing this problem, the problem was (for me) installing the preview version of visual studio so i just uninstalled it and reinstalled the normal version

Oh yes, I do have the Preview version of VS 2022, and switching to regular version is no-go!

P. S. I initially thought the problem is that Preview resides in its own separate subfolder, but this isn’t it, because clearly the compiler was found and invoked, it just didn’t like UE’s code.

I also have a regular (non-Preview) Community version of VS 2019 installed alongside the 2022, is there a way to tell UE 5 to use VS 2019?

This is broken in the Visual Studio 17.9 update. If you roll back to 17.8 you should be ok.

2 Likes

I also experienced this error message, though in the context of opening an Unreal 5.3 project pulled from source control.

The solution for me was adding the modules “Game development with C++” as well as “Desktop development with C++” for Visual Studio 2022. After installing only the first module and opening the project in Visual Studio I was prompted to install the second one.

i cant find how to return 17.8 can u help me pls…

Open the Visual Studio Installer, next to your Visual Studio install press the More button then press rollback to previous version

1 Like

This is the bug report on VS community, please support that ticket there: Developer Community

Not seeing that option in my Visual Studio Installer.

That might be because you downloaded and installed it recently, and didn’t upgrade it? To install a specific version, see the accepted answer in this thread: https://learn.microsoft.com/en-us/answers/questions/770494/is-it-possible-to-install-a-prior-build-version-of

Are you on VS 17.8.x or 17.9? (17.8.5 works) I’m also building the release branch of the github repo.

Temporary workaround is to use 17.10 Preview Community, according to the VS Developer Community

1 Like

this is fix the error: Developer Community

This is our solution for now.
\Engine\Source\Runtime\Core\Public\Experimental\Containers\HazardPointer.h

3 Likes

Just to wrap up this thread you have three options. I would do them in this order if you can.

Option 1: Rollback to 17.8.x in Visual Studio
How To:

Downsides:

  • If you did not install 17.8 you cannot roll back to it.

Option 2: Update to Preview Version
How To:
Same as above but select “Update” Settings and select Preview instead of current.

Downsides:

  • Previews can be less stable so it may have conflicts with your particular project. (This is unlikely though)

Option 3: Make the FHazard Variable Public

How To:
See frankmli’s suggestion above

Downsides:

  • If you do a lot of .cpp surrounding that you may write code that relies on it being public that is not supported.
  • It requires an engine change and rebuild of the engine for your team.
7 Likes

My UE5 setup was working perfectly. Then I decided to install copilot. It said I needed to update Visual Studio. In a grand mistake I clicked that update button. For some reason Microsoft won’t let you choose a version with community edition. Now I’m stuck running the preview edition of visual studio 2022. Other errors forced me to start compiling the engine from this fork: https://github.com/DreamSworK/UnrealEngine/tree/a3e283c172166168f08acc007a01aa128cce10f5
Found here:
Error compiling the Automation Tool after updating Visual Studio today (Unreal 5.3.2) - #12 by Jithak

It does work for me!! Thank you so much!!

Oh~~~~! Good~ Nice~! I got it!