USTRUCT in its own .h does not compile

I have a basic struct like the one below. It used to be at the top of a class file, but I moved it out to its own file. Then FString was no longer sensed as an existing class, the GENERATED_USTRUCT_BODY() macro is underlined as problematic, etc. strange errors. I tried moving it back to its original file, but the errors persisted. What’s going on here?

#pragma once
#include "InteractableAction.generated.h"

USTRUCT(BlueprintType)
struct FInteractableAction {

	GENERATED_USTRUCT_BODY()

	UPROPERTY(BlueprintReadOnly)
	FString name;

	FInteractableAction() {}
	FInteractableAction(FString name) {
	}

};

Include main header file

#include "ProjectName.h"

Didn’t work for me.

You tried rebuild?

I’ve rebuilt, removed all the changed files, restarted the editor, added them back then rebuilt again, but to no avail. It can’t even find the “ProjectName.h” file (which seems only to be included in .cpp files–when I add a class via the editor, the generated .h file does not contain it). Is it by any chance impossible to put only a USTRUCT in an .h file?

As far as i know, the generated.h is generated where there is a class.
Maybe, since there’s just a struct, it doesn’t care about it.
Try to ccheck if something is generated at all, like “InteractableAction.generated.h”, or maybe “YourHFileName.generated.h”

Ah! don’t forget to regenerate the visual studio project files too!

Thanks, didn’t know about the generated file being restricted to classes. It does indeed not exist here. Looks like I’m just going to have to move it back or change it into a class.

It’s silly but apparently the only thing I was missing is to include “EngineMinimal.h”, which is included in the ProjectName.h file and thus can be seen as an alternative for it. Don’t know if this is the ‘right’ way to do it per say, but it compiles fine and works fine, generated file and all.