Error upon creating a new c++ project

Upon creating a new “third person” project I am hit with this error message:

An error occurred while trying to generate project files.

Running C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/Build.bat -projectfiles -project=“C:/Users/name/OneDrive/Documents/Unreal Projects/MyProject3/MyProject3.uproject” -game -rocket -progress
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“C:/Users/name/OneDrive/Documents/Unreal Projects/MyProject3/MyProject3.uproject” -game -rocket -progress
‘dotnet’ is not recognized as an internal or external command,
operable program or batch file.


A similar error occurs when I attempt to create a c++ class.

Is there any way to fix this?

I think you are missing .NET. You can install it from here: Download .NET (Linux, macOS, and Windows)

I installed .NET, but I still get an error message when trying to create a new C++ class:

Successfully added class ‘MyCharacter1’, however you must recompile the ‘MyProject4’ module before it will appear in the Content Browser. Failed to generate project files.

Would you like to open the Output Log to see more details?

How do I recompile? I hate to sound like an idiot, but I’m very new to this.

No problem, if you are new to C++ it can be a little hard at the very beginings.
First, as @Bojann said, make sure that you have installed .NET sources. Second, its very important that you have installed these 3 developper (Sorry for spanish)

Once you done installed it , you want to double click in your .uproject file and select “Generate Visual Studio project files” and wait until the new .sln file is created. Open it and, press Ctrl+Shift+B to build that source code. It now should work

Let me know if you succeded! Good luck!

1 Like

image
I did what you told me to do, but it doesn’t seem to be working.

Try going to your project folder, and deleting the folders Binaries, Intermediate, and Saved. and then, right click in your .uproject file and select “Generate Visual Studio project files” and see how it works

1 Like

Ah yes, I know this issue. Happens to me all the time.

  1. Close your UE Editor
  2. Open your MyCharacter1.cpp file in the IDE you use (if you are not using Rider, consider doing so).
  3. At the top, you will probably see that import is messed up. It will be something like:
    #include "Some_path/MyCharacter1.h", remove Some_path if your .h and .cpp files are in the same directory, and compile should start working.

If they are in a different directory, just make sure you use proper directory tree in the include. And all should start working for you.

Please give us the screenshot of the file tree where CPP and H file are located if you are unable to resolve it. And give us the proper log stack so that we can help.

1 Like

The solution was much simpler than I thought it to be. I had to change my default IDE to VS code.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.