Can't build c++ project

Hi, i am studying UE5.0.3 now, i created new c++ empty project, and add a new empty c++ class, but when i build it by right click the “Game” folder on the Visual Studio Community 2019, the VS hint many errors, such as “Can’t open ‘CoreMinimal.h’”, “Can’t open ‘Containers/Ticker.h’”, etc,. What wrong happened? how should i do next? thank you very much.

Can you show a screenshot of the top of your header file? Could it be that you have the wrong order for includes?

Do you have an Engine folder above you games folder in your project? (reference to the game engine)

The VS Hints can be incorrect for a few reasons:

  • It’s not aware of all the steps of the build system that UBT uses, so might get some false positives.
  • It will give incorrect errors until the first build of the project as the *.generated.h files haven’t been created yet.

Because of that you should generally ignore the hints.

To know what really failed with a build you should check the text from the Output panel, which comes from Unreal Build Tool (UBT). What errors do you get from there?

1 Like

Thank Ari_Epic and 3dRavewn very much, follows are MyObject.h and screen shots, and now i don’t konw how to fix it.
//--------------------------------
#pragma once

#include “CoreMinimal.h”
#include “UObject/NoExportTypes.h”
#include “MyObject.generated.h”

UCLASS()
class TEST1_API UMyObject : public UObject
{
GENERATED_BODY()
};
//--------------------------------

http://blusped.com/temp/err2.jpg
http://blusped.com/temp/err3.jpg

It doesn’t seem to see the engine files correctly.

Perhaps try closing the project and regenerating the c++ project files

  • right click project name with blue unreal logo
  • choose generate visual studio project files
  • run visual studio project and see if includes and base classes still show errors.

The third image shows you again using the Error List window. Look closely at the picture from my previous post:

Don’t use the Error List window, just ignore that whole window. That’s Visual Studio trying to compile the project for us in advance to tell us what’s broken, but the thing is that under the hood Visual Studio will not actually be building the whole project, Visual Studio will just call the Unreal Build Tool (UBT) which handles actually compiling the project.

UBT, the actual built tool for UE, will give its output and errors encountered in the Output window, as I show on the picture ↑. That’s why it’s important to only read the Output window and not the Error List window.

I have a successfully compiled Unreal Editor running on my computer but the Error List is still full of “errors”, that’s what the picture above is showing. Ignore that window.


That might help with the hints and the Error List window showing a bit less errors, but like I said those should be ignored, in the end it won’t have any effect on whether the project will compile successfully or not since Unreal doesn’t use the Visual Studio solution for building. It just calls UBT which uses the *.Build.cs files and *.Target.cs files, which are the real project files. The Visual Studio Solution files are only for your convenience. You can build your game without any solution files, you don’t need to use Visual Studio at all. In fact, you could use Notepad to write code and compile your game from the command line. You don’t even need to have Visual Studio installed on your computer to successfully compile Unreal Engine games, you just need the MSVC compiler tools installed.

1 Like