Use struct from another class in Interface

Hi, i’m getting “Unrecognized type ‘FRandomStruct’ - type must be a UCLASS, USTRUCT or UENUM” error when I try to use a struct from another class in an interface function.

Interface.h

#pragma once

#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "InventoryInterface.generated.h"

struct FRandomStruct;

UINTERFACE(MinimalAPI)
class UInventoryInterface : public UInterface
{
	GENERATED_BODY()
};

class INVENTORY_API IInventoryInterface
{
	GENERATED_BODY()
public:

	UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
		void OnSlotChanged(FRandomStruct& SlotInfos);  //// Line throwing the error
};

[Class declaring the struct].h

[...]
USTRUCT(BlueprintType)
struct FRandomStruct
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		int test;
};
[...]

I tried to forward declare (still getting the error) and to include the file containing the struct (throw “Circular dependency” error).

Is there a specific method to use a struct from another class inside an Interface?

AFAIK UHT does not provide the ability to forward declare USTRUCTs so you have no choice but to include the file with the definition of the struct in your Interface.h. That shouldn’t give you a circular dependency though, maybe you have included Interface.h in [Class declaring the struct].h as well? That would then be a circular dependency.

maybe you have included Interface.h in [Class declaring the struct].h as well?
Yes the class was implementing the interface, removing it and it now compiles fine. Thank you