ENUM() not recognized any more

Hello,

It seems I have messed up the compiler somehow, probably because I moved the project folder to another place.
I can’t compile the following code any more:

SomeFile.cpp:

#include "GameFramework/Actor.h"
#include "SomeFile.generated.h"


UENUM()
namespace EMode
{
	enum Type
	{
		None,
		Mode1,
		Mode2
	};
}

.
.
.

The compiler outputs: "syntax error : missing ‘;’ before ‘namespace’.

I tried to recompile the engine and the game-project, cleaning intermediate folders for both.

Any clue what went wrong ?

Thanks

#Solution
#Code For You

Here’s an example of an Enum whose code I know compiles perfectly in 4.5

You can adapt this code to your needs!

If this doesnt compile in your project then you have some kinda fundamental issue in your project code base

//~~~~~~~~~~~~~~~~~~~~~~
// Solus Key Modifiers
//~~~~~~~~~~~~~~~~~~~~~~
UENUM(BlueprintType)
namespace ESolusKeyModifiers
{
	//256 entries max
	enum Type
	{
		None				UMETA(DisplayName="None"),
		ControlKey		UMETA(DisplayName="Control Key"),
		AltKey				UMETA(DisplayName="Alt Key"),
		ShiftKey			UMETA(DisplayName="Shift Key"),
	
		//~~~
		
		//256th entry
		ESolusKeyModifiers_Max		UMETA(Hidden),
	};
}

Hey Rama,

I have now found out, what caused the confusing compiler error.

I pasted accidentally some characters before the first precompiled #include line in one of my cpp (!) files.

While parsing the headers at start of the build, the related “MyFile.generated.h” file was not correctly updated, which caused also problems with the CLASS() keyword, as soon as I removed the ENUM for testing purposes.

I had to find out this the hard way. I wonder if the unreal build system could output a better error description in this case :confused:

Anyway, thanks for your suggestion!