UENUM class not compiling in editor

Hello, I’m trying to write a C++ class for downloading files and I’ve set up an enumerator class for reporting the results of the requests I’m making.



/**
* Possible results from a download request.
*/
UENUM (BlueprintType, Category = "HTTP")
enum class EUpdateResult : uint8 {

NoNewUpdatesAvailable,
FailedDownload,
LocalSaveDirectoryFailure,
LocalSaveSuccess,
SuccessfulDownload
};

The error I’m getting when compiling in the Unreal Editor is:

Sounds like you need to forward-declare your enum in a header that’s trying to use it. In Updater.h, add this after the #includes:



enum class EUpdateResult: uint8;


If that doesn’t work, you’ll need to add the header file you declared the enum in to the include list of updater.h

1 Like

Your error is complaining about EDownloadResult while you have shown the code for EUpdateResult, could be you haven’t updated all references to the enum after changing the name.

Agree with Telimaktar. You never need to forward declare enums for UHT’s purpose. Your EUpdateResult looks proper. and going by the error code, I further believe Telimaktar is correct in guessing it is a botched refactor.

The only other thing I’ve ran into with UHT ( and this may have been fixed ) is the issue of macro defines above any UENUM/USTRUCT/ whatever that throw UHT off any require semicolon (:wink: at the end to keep UHT happily parsing along.

This is unrelated to the problems you’re having, but I really do recommend this format for defining enumerations in UE4: Enumerations in Unreal Engine 4 · GitHub

(The comments in the gist explain the differences).