Visual Studio permission error when I want to build

hello , I’ve got this issue with visual studio … I’m watching a tutorial on udemy for unreal engine and whenever i try to build my code it fails even though the code is written correctly , exactly as the instructor has as well…

this is the error that I`m getting:

1>------ Build started: Project: BuildingEscape, Configuration: Development_Editor x64 ------
1> Compiling game modules for hot reload
1> Performing 2 actions (2 in parallel)
1> [2/2] Link UE4Editor-BuildingEscape-2523.lib
1> [1/2] Link UE4Editor-BuildingEscape-7173.dll
1> Creating library D:\Unreal Projects\03_BuildingEscape\BuildingEscape\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-BuildingEscape-7173.lib and object D:\Unreal Projects\03_BuildingEscape\BuildingEscape\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-BuildingEscape-7173.exp
1> Creating library D:\Unreal Projects\03_BuildingEscape\BuildingEscape\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-BuildingEscape-7173.suppressed.lib and object D:\Unreal Projects\03_BuildingEscape\BuildingEscape\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-BuildingEscape-7173.suppressed.exp
1>ERROR : UBT error : Failed to produce item: D:\Unreal Projects\03_BuildingEscape\BuildingEscape\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-BuildingEscape-2523.lib
1> Total build time: 3.07 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3075: The command ““D:\Unreal Engine\Engine\UE_4.15\Engine\Build\BatchFiles\Build.bat” BuildingEscapeEditor Win64 Development “D:\Unreal Projects\03_BuildingEscape\BuildingEscape\BuildingEscape.uproject” -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

PS: I have tried to run visual studio with admin rights , still the same error.

That appears to be a Hot Reload error (which rarely works). I’d do a Clean/Rebuild on the project from within Visual Studio (without the editor open).

It did work after I rebuilt it , however every time i write code wrong and I build it , i get that same error , even if I correct the code after , the error will persist , and I will have to rebuild again…
Any suggestions on how to fix this?

I think this is the same issue as in this thread:

For me, this is only happening since 4.16, but the workaround described in the other thread (compiling using the Compile button in the Editor) has worked, you might want to give it a shot.

Yes , compiling using the button in the editor seems to be working ! thanks

What if the project does not run? So i don’t go to the editor?

In my case this happened when I moved a property that had BlueprintReadOnly or BlueprintReadWrite to a private section of the header, it quickly shows the right error but then clears and displays “-waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command.".
A full rebuild actually made it so i could read the right errors.

I had a similar problem. I isolated all the new code I added and start revealing them one by one while trying to build each time. It seems that “UPROPERTY(BlueprintReadWrite)” was casing the problem. I placed it under a “protected:” section and was able to build successfully.

Lol just had the same issue with UPROPERTY(BlueprintReadWrite) even though it was under protected. Commented out altogether, built with no problem.

I’ve just hit the same issue after upgrading Visual Studio 2019 to the latest version… compiling from the Editor still works though