Include a enum in c++

Hello, your enum seems to look completely fine. It might be a case of Visual Studio acting up. You could try going into UE4 editor(the level)->File->RefreshVisualStudioProject, wait for it to do that then go to visual studio and a popup box will appear select: override all->SaveAll->Close and Re-open Visual Studio… it does this to me too sometimes, doing this might fix it. Also compile as a safety check(optional). Let me know if it works! :slight_smile:

Hello, it’s been a long time that I block on a problem that I do not understand. I created an enumeration ( “WeaponSpreadType_Enum.h” and “WeaponSpreadType_Enum.cpp” ) for use in c ++ and blueprint, but the inclusion does not seem to want to be done in c++ script and I receive this error every time “Unrecognized type ‘EWeaponSpreadType’ - type must be a UCLASS, USTRUCT or UENUM”
And I do not forget to add #include “WeaponSpreadType_Enum.h” in my script

Thank you for your help

WeaponSpreadType_Enum.h :

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "WeaponSpreadType_Enum.generated.h"
/**
*
*/

UENUM(BlueprintType) //Blueprint Temporaire
enum class EWeaponSpreadType : uint8
{
	WST_FullCircle        UMETA(DisplayName = "FullCircle"),
	WST_Circle			UMETA(DisplayName = "Circle"),
	WST_FullSquare		UMETA(DisplayName = "FullSquare"),
	WST_Square			UMETA(DisplayName = "Square"),
	WST_Line			  UMETA(DisplayName = "Line")
};

Incase if the above doesn’t work, include the file again… that will force UnrealHeaderTool to see it.

I did it but it does not seem to work. :confused: However I just noticed that the problem seems to happen only in the .h file of my script, if I add EWeaponSpreadType WeaponSpreadTypeEnumTest = EWeaponSpreadType::WST_FullCircle; in the .cpp file It work good

No proposal?

Hello,
this problem has been solved since, must include in script.h file no in script.cpp file