Can't create a new C++ project

Hi there.

I am kind of new to Unreal Engine, and I want to create a C++ project so I can learn how to program in C++. However, every time I try to create one, I am met with this error:


The project could not be compiled. Would you like to open it in Visual Studio?

Running C:/Program Files/Epic Games/UE_4.26/Engine/Binaries/DotNET/UnrealBuildTool.exe Development Win64 -Project="C:/Users//Documents/Unreal Projects/FirstCPP/FirstCPP.uproject" -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
Creating makefile for FirstCPPEditor (no existing makefile)
@progress push 5%
Parsing headers for FirstCPPEditor
Running UnrealHeaderTool "C:\Users\\Documents\Unreal Projects\FirstCPP\FirstCPP.uproject" "C:\Users\\Documents\Unreal Projects\FirstCPP\Intermediate\Build\Win64\FirstCPPEditor\Development\FirstCPPEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed
Reflection code generated for FirstCPPEditor in 9.3004591 seconds
@progress pop
Building FirstCPPEditor...
Using Visual Studio 2019 14.28.29910 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910) and Windows 10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10).
ERROR: Unhandled exception: System.UnauthorizedAccessException: Access to the path 'C:\Program Files\Epic Games\UE_4.26\Engine\Intermediate\Build\XGETasks.xml' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at UnrealBuildTool.XGE.WriteTaskFile(List`1 InActions, String TaskFilePath, Boolean bProgressMarkup, Boolean bXGEExport) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Executors\XGE.cs:line 518
at UnrealBuildTool.XGE.ExecuteActionBatch(List`1 Actions) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Executors\XGE.cs:line 351
at UnrealBuildTool.XGE.ExecuteActions(List`1 ActionsToExecute, Boolean bLogDetailedActionStats) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Executors\XGE.cs:line 330
at UnrealBuildTool.ActionGraph.ExecuteActions(BuildConfiguration BuildConfiguration, List`1 ActionsToExecute) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\System\ActionGraph.cs:line 206
at UnrealBuildTool.BuildMode.Build(TargetMakefile] Makefiles, List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 483
at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 226
at UnrealBuildTool.UnrealBuildTool.Main(String] ArgumentsArray) in D:\Build\++UE4\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 550

I think the problem is in this line:
ERROR: Unhandled exception: System.UnauthorizedAccessException: Access to the path ‘C:\Program Files\Epic Games\UE_4.26\Engine\Intermediate\Build\XGETasks.xml’ is denied.

When I went to the above path on my computer, I couldn’t find the XGETasks.xml folder.
How do I fix this?

Hard to say what’s the problem from just this. Usually these kinds of errors happen when you have opened files in another program that UE wants to use, you don’t have access rights to the path (are you administrator?) or the directory is read-only. Often a restart of the computer also solves these kinds of errors. If that doesn’t help you could try to set the C:\Program Files\Epic Games\UE_4.26\Engine\Intermediate folder to not be read-only.

As Grim mentioned, restarting might help.

System.IO is what handles the classes which are used to read and write data to files or data streams.

Basically, from what I can tell, try this:

  1. Firstly, do you have a source installation of the engine on as well at this one? The reason I ask this is because, in the UnrealBuildTool commands, it tries to read from D:/ instead of C:/. If that is an external drive, then disconnect it. If it is an internal drive if you know how to and you don’t need it, temporarily disable it, make your project, and reenable it.
  2. Second, I would try to verify the engine since the XMLTasks.xml file not being created could be a result of some missing engine files.
  3. Third, make sure you are an administrator on your computer since the ProgramFiles folder required administrator. Admittedly reading files from it (as you are doing) shouldn’t, however, the first time you launch the engine it needs to build the intermediate folder.

I am pretty sure the first is your best candidate, since either way, reading from two different locations is going to cause errors.

Good luck,

I’ve also had read/write errors that happen because of my anti-virus software (AVG). I had to disable protection and then run the Build and all worked. When I enabled the virus protection afterwards, the error never happened again.

Thank you, everyone, for your advice, but I fixed the problem by running Unreal Engine as an administrator and building the project.