Can't open source file filename.generated.h

Created a new blank plugin, trying to add #include "filename.generated.h" to the header of filename.h - I get this error “Can’t open source file filename.generated.h”

The file should be generated automatically, but for some reason it doesn’t.
UE version 5.0.3

I think there used to be a bug similar to this. It was caused by the wrong file path and something to do with the intermediate folder. I don’t remember how they fixed it though.

1 Like

Hello @GenericNickname7! I recommend you try to Rightclick on .uproject and Generate VS project files, I haven´t tried to look for this option on unreal engine 5 myself but I assume it´s available. Hope that helps!

1 Like

Hi @Gamingkaos25 and @Detach789, thank you a lot for your help. Unfortunately, none of the proposed solutions worked. Do you know anything else that could solve this?

I believe this file is not generated if you don’t have a UCLASS / UENUM / USTRUCT in the header. Could be wrong. Post the header file here?

#pragma once

#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "DLCCheck.generated.h"


UCLASS()
class TESTPLUGIN_API DLCCheck : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintCallable, META = (DisplayName = "Has DLC Installed", CompactNodeTitle = "Has DLC Installed", Category = "Steam Custom Nodes"))
		static bool BIsDlcInstalled(int32 AppID);

	UFUNCTION(BlueprintCallable, META = (DisplayName = "Game Installed", CompactNodeTitle = "Game Installed", Category = "Steam Custom Nodes"))
		static bool BIsAppInstalled(int32 AppID);

	UFUNCTION(BlueprintCallable, META = (DisplayName = "Open Store", CompactNodeTitle = "Open Store", Category = "Steam Custom Nodes"))
		static void OpenStore(int32 DLC_AppID);
};

This should not compile for another reason. DLCCheck is not prefixed with a U “class TESTPLUGIN_API UDLCCheck” which is required when inheriting from a UObject.

Thanks for your help @Roy_Wierer.Seda145 . I have tried this, but the error still persists unfortunately

Alright, then we do need a bit more information.

Now the file should be called DLCCheck.h and the class UDLCCheck. TESTPLUGIN is the module name this file lives in.

I assume the project does not build and that the error is a build error. If it’s only an intellisense error you can ignore it, because it’s usually intellisense just failing. You can avoid that by setting the error filter to Build Only:

We have 2 windows of interest, one is the above error log and the other is the Output panel:

Do you see a different error there? Something that could eventually lead to the .generated.h error?