Is including WidgetComponent.h no longer possible in 5.3?

When I include WidgetComponent.h in a .cpp or .h file, I get these compile errors:

1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\FieldNotification\FieldNotificationDeclaration.h(15): warning C4996: 'FieldNotificationDeclarationHeaderDeprecatedWarning': Including FieldNotification/FieldNotificationDeclaration.h is deprecated. The location of has changed. Please include FieldNotificationDeclaration.h instead and add the module FieldNotification to your .build.cs Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(222): error C4042: 'unnamed-parameter': has bad storage class
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(223): error C3646: 'UE_FIELD_NOTIFICATION_DECLARE_FIELD': unknown override specifier
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(223): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(223): error C2059: syntax error: '('
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(230): error C4183: 'UE_FIELD_NOTIFICATION_DECLARE_CLASS_DESCRIPTOR_BASE_BEGIN': missing return type; assumed to be a member function returning 'int'
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(235): error C2143: syntax error: missing ')' before ';'
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(235): error C2059: syntax error: ')'
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(217): error C2259: 'UWidget': cannot instantiate abstract class
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(215): note: see declaration of 'UWidget'
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(217): note: due to following members:
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h(217): note: 'const UE::FieldNotification::IClassDescriptor &INotifyFieldValueChanged::GetFieldNotificationDescriptor(void) const': is abstract
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\FieldNotification\Public\INotifyFieldValueChanged.h(45): note: see declaration of 'INotifyFieldValueChanged::GetFieldNotificationDescriptor'
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Blueprint\UserWidget.h(221): error C2259: 'UUserWidget': cannot instantiate abstract class
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Blueprint\UserWidget.h(219): note: see declaration of 'UUserWidget'
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Blueprint\UserWidget.h(221): note: due to following members:
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\UMG\Public\Blueprint\UserWidget.h(221): note: 'const UE::FieldNotification::IClassDescriptor &INotifyFieldValueChanged::GetFieldNotificationDescriptor(void) const': is abstract
1>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\FieldNotification\Public\INotifyFieldValueChanged.h(45): note: see declaration of 'INotifyFieldValueChanged::GetFieldNotificationDescriptor'

Note that I’ve of course included “UMG” in my project’s .Build.cs file.

Have you tried doing as described?

The one including FieldNotificationDeclaration.h is UE_5.3\Engine\Source\Runtime\UMG\Public\Components\Widget.h (part of engine UMG code), not my code - so I can’t exactly alter that

It is used by a preprocessor UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2 so you should be able to alter it indirectly however now that I read it again your real problem seems to be

Perhaps someone else has some ideas of how to solve this?

Did you find the solution to this in the end? I’ve also encountered it when upgrading to 5.3. It seems to point towards a bunch of the engine widget related classes, along with a couple of my custom UUserWidget derived classes.

I’ve tried adding the FieldNotification to my build.cs, but reality is its not directly my code that’s including FieldNotificationDeclaration.

Will post back if I solve this :slight_smile:

I found the problem…

In 5.3 the default build settings (in Target.cs files) have been updated to enforce full includes. My project was using an older default build settings, which allowed non-full includes. The unfortunate thing was this meant that the engine code was erroneously including the deprecated FieldNotificationDeclaration - rather than the newer one in its own module.

I think this was actually introduced in 5.2 as the ModuleRoles.bLegacyParentIncludesPaths = false" became the new default.

The downside for me personally now was I now need to change all includes in my project to be full includes, but thats on me for being lazy. A crap shortcut I took for my own sanity was to add all my projects subdirectories to my PublicIncludePaths in my build.cs. Also, find and replace is your friend :slight_smile: Goodluck to any poor soul who finds their self in the same position.

1 Like

So we are having the same issue with 5.3.2. I don’t see this “ModuleRoles.bLegacyParentIncludesPaths” anywhere in the code or documentation. Can someone help with a more specific resolution to this? What do you have to do to change this setting or switch to “full includes”?

Ok, I see there was a typeo and got the right parameter. I’ve set these two in my Target.cs file:

   bLegacyParentIncludePaths = true;
bLegacyPublicIncludePaths = true;

But still having the error. Any other ideas?

I just simply removed the deprecated file “\FieldNotification\FieldNotificationDeclaration.h” and the error has gone. :smiling_face:

Oh, I forgot it, I am using the Engine 5.3.2 Compiled from source code.