Derived class from UserWidget does not work

I followed what I have to do in this tutorial below,
A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums.

Version is 4.6.1

but still does not work with below error msg


Creating library C:\Users\Jae\Documents\Unreal Projects\MyProject2\Intermediate\Build\Win64\MyProject2Editor\Development\UE4Editor-MyProject2-6296.lib and object C:\Users\Jae\Documents\Unreal Projects\MyProject2\Intermediate\Build\Win64\MyProject2Editor\Development\UE4Editor-MyProject2-6296.exp
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual class FPrimitiveSceneProxy * __cdecl UWidgetComponent::CreateSceneProxy(void)” (?CreateSceneProxy@UWidgetComponent@@UEAAPEAVFPrimitiveSceneProxy@@anonymous_user_9674a66c)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual class FPrimitiveSceneProxy * __cdecl UWidgetComponent::CreateSceneProxy(void)” (?CreateSceneProxy@UWidgetComponent@@UEAAPEAVFPrimitiveSceneProxy@@anonymous_user_9674a66c) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol "public: virtual struct FBoxSphereBounds __cdecl UWidgetComponent::CalcBounds(class FTransform const &)const " (?CalcBounds@UWidgetComponent@@UEBA?AUFBoxSphereBounds@@AEBVFTransform@@@Z)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual struct FBoxSphereBounds __cdecl UWidgetComponent::CalcBounds(class FTransform const &)const " (?CalcBounds@UWidgetComponent@@UEBA?AUFBoxSphereBounds@@AEBVFTransform@@@Z) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual class UBodySetup * __cdecl UWidgetComponent::GetBodySetup(void)” (?GetBodySetup@UWidgetComponent@@UEAAPEAVUBodySetup@@anonymous_user_9674a66c)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual class UBodySetup * __cdecl UWidgetComponent::GetBodySetup(void)” (?GetBodySetup@UWidgetComponent@@UEAAPEAVUBodySetup@@anonymous_user_9674a66c) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol "public: virtual struct FCollisionShape __cdecl UWidgetComponent::GetCollisionShape(float)const " (?GetCollisionShape@UWidgetComponent@@UEBA?AUFCollisionShape@@anonymous_user_142fbdd5@Z)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual struct FCollisionShape __cdecl UWidgetComponent::GetCollisionShape(float)const " (?GetCollisionShape@UWidgetComponent@@UEBA?AUFCollisionShape@@anonymous_user_142fbdd5@Z) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::OnRegister(void)” (?OnRegister@UWidgetComponent@@UEAAXXZ)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::OnRegister(void)” (?OnRegister@UWidgetComponent@@UEAAXXZ) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::OnUnregister(void)” (?OnUnregister@UWidgetComponent@@UEAAXXZ)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::OnUnregister(void)” (?OnUnregister@UWidgetComponent@@UEAAXXZ) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::DestroyComponent(void)” (?DestroyComponent@UWidgetComponent@@UEAAXXZ)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::DestroyComponent(void)” (?DestroyComponent@UWidgetComponent@@UEAAXXZ) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)” (?TickComponent@UWidgetComponent@@UEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::TickComponent(float,enum ELevelTick,struct FActorComponentTickFunction *)” (?TickComponent@UWidgetComponent@@UEAAXMW4ELevelTick@@PEAUFActorComponentTickFunction@@@Z) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FComponentInstanceDataBase * __cdecl UWidgetComponent::GetComponentInstanceData(void)const " (?GetComponentInstanceData@UWidgetComponent@@UEBAPEAVFComponentInstanceDataBase@@anonymous_user_9674a66c)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual class FComponentInstanceDataBase * __cdecl UWidgetComponent::GetComponentInstanceData(void)const " (?GetComponentInstanceData@UWidgetComponent@@UEBAPEAVFComponentInstanceDataBase@@anonymous_user_9674a66c) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2Character(void)” (?Z_Construct_UClass_AMyProject2Character@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FName __cdecl UWidgetComponent::GetComponentInstanceDataType(void)const " (?GetComponentInstanceDataType@UWidgetComponent@@UEBA?AVFName@@anonymous_user_9674a66c)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual class FName __cdecl UWidgetComponent::GetComponentInstanceDataType(void)const " (?GetComponentInstanceDataType@UWidgetComponent@@UEBA?AVFName@@anonymous_user_9674a66c) referenced in function “void __cdecl `dynamic initializer for ‘Z_CompiledInDefer_UClass_AMyProject2Character’’(void)” (??__EZ_CompiledInDefer_UClass_AMyProject2Character@@YAXXZ)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::ApplyComponentInstanceData(class FComponentInstanceDataBase *)” (?ApplyComponentInstanceData@UWidgetComponent@@UEAAXPEAVFComponentInstanceDataBase@@@Z)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::ApplyComponentInstanceData(class FComponentInstanceDataBase *)” (?ApplyComponentInstanceData@UWidgetComponent@@UEAAXPEAVFComponentInstanceDataBase@@@Z) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2GameMode(void)” (?Z_Construct_UClass_AMyProject2GameMode@@YAPEAVUClass@@anonymous_user_9674a66c)
1>ShooterWidget.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)” (?PostEditChangeProperty@UWidgetComponent@@UEAAXAEAUFPropertyChangedEvent@@@Z)
1>MyProject2.generated.cpp.obj : error LNK2019: unresolved external symbol “public: virtual void __cdecl UWidgetComponent::PostEditChangeProperty(struct FPropertyChangedEvent &)” (?PostEditChangeProperty@UWidgetComponent@@UEAAXAEAUFPropertyChangedEvent@@@Z) referenced in function “class UClass * __cdecl Z_Construct_UClass_AMyProject2GameMode(void)” (?Z_Construct_UClass_AMyProject2GameMode@@YAPEAVUClass@@anonymous_user_9674a66c)
1>C:\Users\Jae\Documents\Unreal Projects\MyProject2\Binaries\Win64\UE4Editor-MyProject2-6296.dll : fatal error LNK1120: 12 unresolved externals
1> -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Users\Jae\Documents\Unreal Projects\MyProject2\Binaries\Win64\UE4Editor-MyProject2-6296.dll
1> Cumulative action seconds (8 processors): 0.00 building projects, 24.70 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.11 linking, 0.00 other
1> UBT execution time: 30.37 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ““C:\Program Files\Epic Games\4.6\Engine\Build\BatchFiles\Build.bat” MyProject2Editor Win64 Development “C:\Users\Jae\Documents\Unreal Projects\MyProject2\MyProject2.uproject” -rocket” exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Hi,

I’ve tried that tutorial myself using 4.6 (and 4.7) but didn’t see any linker errors (I’ve attached my project for reference).

Could you double check the .Build.cs file for your project to make sure you’re linking to the UMG module.

Thanks,
Jamie.

Jamie,

I did not compile after the .Build.cs and header includes before derive a classs from UUserWidget.

It seems to work great now.

However, I have one questions that,

what if I want to get a specific Button in the widget and invoke OnClicked or OnHovered event manually by calling from code in C++?