OMG, You just saved me. Thank you for posting.
Never would have thought that referencing UWidget in CPP would have required a dependency module…
Because I am a noob as well, and this is the second time I’ve run into a dependency problem that took me hours to sort through, I’ll try to add more info (as best I can with limited experience) so that the next person can slingshot past where I’m at
My build errors were as follows:
unresolved external symbol "__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UWidget_NoRegister(void)" (__imp_?Z_Construct_UClass_UWidget_NoRegister@@YAPEAVUClass@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static struct UECodeGen_Private::FObjectPropertyParams const Z_Construct_UFunction_APoopiePlayerController_TrackOpDetailView_Statics::NewProp_View''(void)" (??__E?NewProp_View@Z_Construct_UFunction_APoopiePlayerController_TrackOpDetailView_Statics@@2UFObjectPropertyParams@UECodeGen_Private@@B@@YAXXZ)
and
1 unresolved externals
The Construct_UClass_UWidget_NoRegister(void)
, dynamic initializer for 'public: static struct
and unresolved externals
(I think), are the bread crumbs that would key you in on UWidget as a missing Public Dependency module.
The build error began when I tried to add a UFUNCTION(Blueprintcallable)
function that referenced a UWidget in cpp.
For whatever reason, if I removed the UFUNCTION(Blueprintcallable)
, it would build but I wouldn’t be able to call that function from a blueprint (which is what I needed).
As the OP said, the answer, was to add “UMG” to the list in build.cs file on the line that has the PublicDependencyModuleNames.AddRange
. In my setup, it was mycoolproject.Build.cs
I hope this helps someone else.