Download

Cannot open source file "xx.generated.h"

I have a solution and I’m happy to share it cause I couldn’t for the life of me figure it out until now.

This is an error in Visual Studio when starting a brand new C++ project and when creating a new class in UE4.20.1

First, go to the file where Epic Games is installed, and then go over to UE_4.20 (or UE_4.19). From here, the directory you want to copy is going to look like this

“…\UE_4.20\UE_4.20\Engine\Intermediate\Build\Win64\UE4Editor\Inc\Engine”

Don’t copy that though, because when I did it didn’t fix my issue. What you want to do is go to that directory and then right-click “Engine”, the last folder, and click “Copy address as text”.

Now go to Visual Studio, look over to the Solution Explorer, drop down the arrow on “Games” and right click your project’s file name and click on properties.

Look down and click on NMake, look over to the right and click on “Include Search Path.” There should be an drop down arrow on the right, click that and click edit.

On the top right corner, there’s a file with a star, it’s called “New Line,” you’re gonna want to click that and then copy and paste the address you’ve copied into the line. Click OK and Apply and you should be good to go.

That’s a HUGE Thank You !

Thats a ditto

You are a god!

This solution didn’t quite work for me for VS Code on UE4 version 4.24, but it did point me to the right direction.

The folder that held the ***.generated.h **file I was searching was inside the proyect folder:

{Project Folder}\Intermediate\Build\Win64\UE4Editor\Inc{Project Name}\

I added that to the include path for IntelliSense Configurations and it fixed my issue. (If this doesn’t work for you, try installing some software like “Everything” and search your whole computer for the generated header.)

Hey @Snooze-doo , I added that path to my c_cpp_properties.json in VS Code which seems to have fixed that issue of finding the ClassName.generated.h file, however after doing so it seemed to break basic C++ things, underlinning the name of my class and Super in my .cpp file and being mad about colons instead of semi colons (despite the syntax being correct). Any ideas what could be causing this? Can you post a copy of your working c_cpp_properties.json file? I’m in 4.25.3.