Getting compile error when using C++11 strongly typed enums

According to the Unreal documentation for coding standards ( you can use the new strongly typed enums from C++11 with the UENUM macro, yet when I try to do this I get the compile error:

Error	1	error : In TemporaryUHTHeader_StatSupport: Missing '{' in 'Enum'

My enum declaration looks like:

enum class EStat : uint8    // <-- Compile error here
	Stat_Health 				UMETA(DisplayName = "Health"),
	Stat_HealthSegments 		UMETA(DisplayName = "HealthSegments"),
	Stat_HealthRegen 			UMETA(DisplayName = "HealthRegen"),
	Stat_Mana 					UMETA(DisplayName = "Mana"),
	Stat_ManaRegen 				UMETA(DisplayName = "ManaRegen"),
	Stat_MeleeAttackPower 		UMETA(DisplayName = "MeleeAttackPower"),
	Stat_MeleeAttackSpeed 		UMETA(DisplayName = "MeleeAttackSpeed"),
	Stat_RangedAttackPower 		UMETA(DisplayName = "RangedAttackPower"),
	Stat_RangedAttackSpeed		UMETA(DisplayName = "RangedAttackSpeed"),
	Stat_KnockDownPower 		UMETA(DisplayName = "KnockDownPower"),
	Stat_KnockDownResistance 	UMETA(DisplayName = "KnockDownResistance"),
	Stat_MeleeAttackRange 		UMETA(DisplayName = "MeleeAttackRange"),
	Stat_ProjectileSpeed 		UMETA(DisplayName = "ProjectileSpeed"),
	Stat_MaxRunSpeed 			UMETA(DisplayName = "MaxRunSpeed"),
	Stat_MaxWalkingSpeed 		UMETA(DisplayName = "MaxWalkingSpeed"),
	Stat_Acceleration 			UMETA(DisplayName = "Acceleration"),
	Stat_Dodge 					UMETA(DisplayName = "Dodge"),
	Stat_Critical 				UMETA(DisplayName = "Critical"),

	Stat_Max					UMETA(Hidden),

Though I get this compile error even if I try the example enum definition from the coding standards documentation. Is the documentation wrong, or am I just missing something?

I have the same problem

Same thing there! If I try to use Enum like it has been shown in the Programming tutorial (3rd Pers Game by Epic), and not using the ENUM() keyworkd I simply get unrecognized type ‘EThing’

enum class EThing : uint8

class ...

EThig GetCurrentThing()const; //fire the Unrecognized type error


In what version of UE4 are you? So we can setup a test of your case :smiley:

I am using the 4.4.2 now !

I was able to use strongly typed syntax when using the 4.3, it was when I did the programming tutorial for third person game!


I’m using 4.4.0 for mine.

Yo Moss!
I’m having exactly the same issue, with 4.4, even with the basic example in the docs:

enum class EThing : uint8

And while we’re at it, even the ENUM_CLASS_FLAGS is broken:

enum class EventTypeMask
	First = (0x1 << 0),
	Second = (0x1 << 1),
	Third= (0x1 << 2),
	Fourth= (0x1 << 3)


This way i get the error:

error C2143: sintax error: ';' missing before '<class-head>'

changing it to ENUM_CLASS_FLAGS(EventTypeMask); seems to solve that issue, but there are still tons of errors.

According to the release notes, this seems to be fixed in 4.5.0. You can find it in the Unreal Header Tool section.

This still occurs in a source build i did today with the following code

#pragma once

#include "Engine/UserDefinedEnum.h"
#include "EnumDecayModes.generated.h"

enum class TESTING_API UEnumDecayModes : uint8 {
	BetaMinus		UMETA(DisplayName = "Beta Minus"),
	BetaPlus		UMETA(DisplayName = "Beta Plus"),
	DoubleBetaMinus UMETA(DisplayName = "Double Beta Minus"),
	DoubleBetaPlus	UMETA(DisplayName = "Double Beta Plus"),
	Alpha			UMETA(DisplayName = "Alpha"),
	Gamma			UMETA(DisplayName = "Gamma"),
	Stable			UMETA(DisplayName = "Stable"),

I’m having this problem in 4.10.2
My intellisense is giving me an error on,

class ATest2GameMode : public AGameMode

error: expexted a ‘;’

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include “GameFramework/GameMode.h”
#include “Test2GameMode.generated.h”

/** enum to store the current state of gameplay */
enum class EPlayState

class ATest2GameMode : public AGameMode


virtual void Tick(float DeltaTime) override;

/** Returns power needed to win - Needed for the HUD */
UFUNCTION(BlueprintPure, Category = "Power")
float GetPowerToWin() const;

virtual void BeginPlay() override;
/** Returns the current Play state */
UFUNCTION(BlueprintPure, Category = "Power")
EPlayState GetCurrentState() const;

/** Sets a new Playing state */
void SetCurrentState(EPlayState NewState);

/** The rate at which the character loses power */
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = “Power”)
float DecayRate;

/** The power needed to win the game */
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Power", Meta = (BlueprintProtected = "true"))
float PowerToWin;

/** The widget class to use for our HUD screen */
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Power", Meta = (BlueprintProtected = "true"))
TSubclassOf<class UUserWidget> HUDWidgetClass;

/** The instance of the HUD */
class UUserWidget* CurrentWidget;

/** Keeps track of current play state */
EPlayState CurrentState;