Adding Userwidget classes causes compile errors
I have been migrating my old 4.7.6 project to 4.8.1 today and part of that is a simple minimap I made using a custom class based on UMG. However, when I add a class extended from the UserWidget class, I suddenly get compile errors from SlateWrapperTypes.h and a bunch of other UI related classes. Classes at the moment don't have content apart from the default Unreal generated content. I wanted to start out with empty classes before I start adding content, to make sure any errors I get are not a direct result of my code (good thing I did).
I have made sure to add "UMG", "Slate", "SlateCore" to the build file (in the addrange bit), so I am not sure what exactly is going wrong here.
The error in question (I only post the first 5 out of a whole washlist of errors. I reckon they share the same core issue);
Error 2 error C2079: 'FEventReply::NativeReply' uses undefined class 'FReply' E:\Game Development\Unreal4\Source\UnrealEngine 4.8.1\Engine\Source\Runtime\UMG\Public\Components\SlateWrapperTypes.h 58 1 ActionGamePrototype
Error 3 error C2027: use of undefined type 'FReply' E:\Game Development\Unreal4\Source\UnrealEngine 4.8.1\Engine\Source\Runtime\UMG\Public\Components\SlateWrapperTypes.h 53 1 ActionGamePrototype
Error 4 error C3861: 'Handled': identifier not found E:\Game Development\Unreal4\Source\UnrealEngine 4.8.1\Engine\Source\Runtime\UMG\Public\Components\SlateWrapperTypes.h 53 1 ActionGamePrototype
Error 5 error C3861: 'Unhandled': identifier not found E:\Game Development\Unreal4\Source\UnrealEngine 4.8.1\Engine\Source\Runtime\UMG\Public\Components\SlateWrapperTypes.h 53 1 ActionGamePrototype
Error 6 error C2146: syntax error : missing ';' before identifier 'FGetCheckBoxState_DelegateWrapper' E:\Game Development\Unreal4\Source\UnrealEngine 4.8.1\Engine\Intermediate\Build\Win64\UE4Editor\Inc\UMG\Widget.generated.h 33 1 ActionGamePrototype
asked Jun 30 '15 at 07:17 AM in C++ Programming
Okay nevermind, I made a stupid mistake. In transferring to the new version, I completely forgot that if you want to extend from the userwidget class, on top of adding to the build class, you also need to add
include "Runtime/UMG/Public/UMGStyle.h" #include "Runtime/UMG/Public/Slate/SObjectWidget.h" #include "Runtime/UMG/Public/IUMGModule.h" #include "Runtime/UMG/Public/Blueprint/UserWidget.h"
to your project header file.
answered Jun 30 '15 at 07:28 AM
answered Aug 06 '16 at 04:20 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here