Can't add code that inherits from WidgetBlueprint class

I have come across this issue using UE4.7.4(binary build) on a Win8.1 x64 using VS2013 Ultimate. When trying to add C++ code through the appropriate menu entry in the editor, and selecting the WidgetBlueprint as parent class an error message pops up saying:

"Failed to add class WhateverYourClassIsNamed. Failed to automatically hot reload the ‘YourProjectName’ module."

After pressing “OK” on the popup, a red warning appears on the class creation window saying:

"The name WhateverYourClassIsNamed is already used by another class."

The thing is, the corresponding .h and .cpp DO get created, however the hot reload fails. What’s more, whenever the newly created class needs to include a header (i.e. all classes except the ones created through the “None” category, right?) the compiler fails to locate the file, no matter how much I fiddle around with the include folders/paths. I’ve checked through the file explorer and the required headers do exist precisely in the folder pointed at by the include path.

Hello, Ventura

It looks like your project is missing UMGEditor module. Please note, that by defaut some modules aren’t included to your Unreal Engine 4 projects. However, they may be needed for some classes. Thus, you need to add the mentioned module. For this, please open Build.cs file of your project (ProjectName\Source\ProjectName\ProjectName.Build.cs). There, you’ll see the line:

  PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

Please add “UMGEditor” to the list and build your project.

Hope this helped! Cheers!

Hi! Thanks for the answer, but I still can’t solve the problem. I did what you suggested, but now I get a C1083:

error C1083: Cannot open include file: ‘Blueprint/WidgetBlueprintGeneratedClass.h’: No such file or directory

I’ve checked the contents of the directory pointed to by this error (C:\Program Files\Epic Games\4.7\Engine\Source\Editor\UMGEditor\Public), and indeed the WidgetBlueprintGeneratedClass.h does not exist. However the “normal” headers do exist in this folder (UMGEditorModule.h, WidgetBlueprint.h, etc.). What’s the problem? I get this error even before I add any classes that inherit from WidgetBlueprint.

I still have the same problem. Do you know how to fix that by now?

Hi Ch4nKyy,

woah it was such a long time ago, I can’t really remember how I solved it. I went through my bookmarks and found this, which actually has gotten updated with a cool tutorial in the Wiki here. I’ve looked through the tutorial and it looks pretty similar to what I think I did myself. I hope this helps a little.