Unable to build new empty C++ project 5.4.2

When trying to create a new empty C++ project, I get the following message.

“The project could not be compiled, would you like to open in Visual Studio?”

Running C:/Program Files/Epic Games/UE_5.4/Engine/Build/BatchFiles/Build.bat Development Win64 -Project="D:/User/Game Design/Unreal/Projects/MyProject/MyProject.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="D:/User/Game Design/Unreal/Projects/MyProject/MyProject.uproject" -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
Log file: C:\Users\user\AppData\Local\UnrealBuildTool\Log.txt
Creating makefile for MyProjectEditor (no existing makefile)
Total execution time: 0.83 secondsype or paste code here

If I try opening the project in UE again, I get the message:
“The following modules are missing or built with a different engine version: MyProject
Would you like to rebuild them now?”

If I select yes, I get the message “MyProject could not be compiled. Try rebuilding from source manually.”

I’ve tried rebuilding the project from VS code and get the error message MSB3073

The command ""C:\Program Files\Epic Games\UE_5.4\Engine\Build\BatchFiles\Build.bat" MyProjectEditor Win64 Development -Project="D:\User\Game Design\Unreal\Projects\MyProject\MyProject.uproject" -WaitMutex -FromMsBuild -architecture=x64" exited with code 6.	MyProject	C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets	Line 44 

Line 44 is

<Exec Command="$(NMakeBuildCommandLine)" Condition="'$(NMakeUseOemCodePage)' == 'true' and '$(NMakeBuildCommandLine)'!=''"/>

Make sure your game is set as the default project in the solution explorer (game name should be in bold)

Check the output log after the failed compile.

I have set game as default ‘Set As Startup Project’ and the game name is in bold. I still receive the same error after compile: MSB3073 (see code in original post).

For further context, I had initially received an error when creating a new C++ project regarding the MSVC v143 build tools version, by default I had (latest) installed and it was asking for v14.38 (an older version). So I installed that component which got rid of that message but left me with the message in my original post.

I have tried uninstalling build tools (latest) and only having the older version installed which didn’t change anything. I also tried reverting back to VS 17.9 (from 17.10) which didn’t help. Plus I also tried completely uninstalling and reinstalling VS, again to no avail.

I wondered if it’s still a compiler version issue - I’ve looked online on how to change the default compiler by right-clicking the game in solution > properties to open up property pages. However I don’t see any options for C++ compiler in my configuration properties.

This might work

That seems to have done the trick! Thank you for the help, it’s much appreciated.

For anyone with the same issue in future, I used version 14.38.33130 as that’s what Unreal was asking for.