Download

problem declaring enum, help needed

hello, i don’t know if this is a noob question, but i’m having some troubles declaring an enum in c++.

i’m getting this error from the compiler



OtherCompilationError (5)

Error	MSB3075	The command ""C:\Program Files (x86)\Epic Games\4.12\Engine\Build\BatchFiles\Build.bat" HellriftEditor Win64 Development "C:\Users\Administrator\Documents\Unreal Projects\Hellrift\Hellrift.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.	Hellrift	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets	37	


i have checked other post and i don’t know where is the problem, this is my code in my .h file



UCLASS()
class HELLRIFT_API ABaseItem : public AActor
{
	GENERATED_BODY()
    
public:	

    // Sets default values for this actor's properties
	ABaseItem();

	UENUM(BlueprintType)
	enum class EItemCategory : uint8
	{
		Common       UMETA(DisplayName = "Common"),
		UnCommon     UMETA(DisplayName = "UnCommon"),
		Rare         UMETA(DisplayName = "Rare")
	};

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseVariables")
		int32 ItemLevel;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseVariables")
		EItemCategory ItemCategory;
};


any help will be appreciated.


UENUM(BlueprintType)
	enum class EItemCategory : uint8
	{
		Common       UMETA(DisplayName = "Common"),
		UnCommon     UMETA(DisplayName = "UnCommon"),
		Rare         UMETA(DisplayName = "Rare")
	};

move this on top of the class declaration and it should work. Like this:



	UENUM(BlueprintType)
	enum class EItemCategory : uint8
	{
		Common       UMETA(DisplayName = "Common"),
		UnCommon     UMETA(DisplayName = "UnCommon"),
		Rare         UMETA(DisplayName = "Rare")
	};

UCLASS()
class HELLRIFT_API ABaseItem : public AActor
{
	GENERATED_BODY()
    
public:	

    // Sets default values for this actor's properties
	ABaseItem();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseVariables")
		int32 ItemLevel;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BaseVariables")
		EItemCategory ItemCategory;
};


I don’t think it’s your code that’s the problem, but your system or installation, or out of RAM, or something like that.
If it is the code, you need to include the error messages that refer the actual code files.

thank you, that worked fine!