I am just trying to create a simple user widget in my c++ unreal engine project which I am doing in visual studio by following this short tutorial: https://benui.ca/unreal/ui-cpp-uuserwidget/. Those are the files:
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "ExampleWidget.generated.h"
// We make the class abstract, as we don't want to create
// instances of this, instead we want to create instances
// of our UMG Blueprint subclass.
UCLASS(Abstract)
class UExampleWidget : public UUserWidget
{
GENERATED_BODY()
protected:
// Doing setup in the C++ constructor is not as
// useful as using NativeConstruct.
virtual void NativeConstruct() override;
};
and
#include "ExampleWidget.h"
void UExampleWidget::NativeConstruct()
{
Super::NativeConstruct();
// Here is where I typically bind delegates,
// and set up default appearance
}
my build fails and gives me 11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl UWidget::FFieldNotificationClassDescriptor::FFieldNotificationClassDescriptor(void)" (__imp_??0FFieldNotificationClassDescriptor@UWidget@@QEAA@XZ) referenced in function "public: virtual struct UE::FieldNotification::IClassDescriptor const & __cdecl UWidget::GetFieldNotificationDescriptor(void)const " (?GetFieldNotificationDescriptor@UWidget@@UEBAAEBUIClassDescriptor@FieldNotification@UE@@XZ)
not just once but multiple times. So this suggest that there is a problem with the linking of files. Here are all the errors
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl UWidget::FFieldNotificationClassDescriptor::FFieldNotificationClassDescriptor(void)" (__imp_??0FFieldNotificationClassDescriptor@UWidget@@QEAA@XZ) referenced in function "public: virtual struct UE::FieldNotification::IClassDescriptor const & __cdecl UWidget::GetFieldNotificationDescriptor(void)const " (?GetFieldNotificationDescriptor@UWidget@@UEBAAEBUIClassDescriptor@FieldNotification@UE@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl UWidget::FFieldNotificationClassDescriptor::~FFieldNotificationClassDescriptor(void)" (__imp_??1FFieldNotificationClassDescriptor@UWidget@@UEAA@XZ) referenced in function "void __cdecl `public: virtual struct UE::FieldNotification::IClassDescriptor const & __cdecl UWidget::GetFieldNotificationDescriptor(void)const '::`2'::`dynamic atexit destructor for 'Instance''(void)" (??__FInstance@?1??GetFieldNotificationDescriptor@UWidget@@UEBAAEBUIClassDescriptor@FieldNotification@UE@@XZ@YAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: static class UClass * __cdecl UUserWidget::GetPrivateStaticClass(void)" (__imp_?GetPrivateStaticClass@UUserWidget@@CAPEAVUClass@@XZ) referenced in function "public: static class UClass * __cdecl UUserWidget::StaticClass(void)" (?StaticClass@UUserWidget@@SAPEAVUClass@@XZ)
11> Hint on symbols that are defined and could potentially match:
11> "__declspec(dllimport) private: static class UClass * __cdecl UObject::GetPrivateStaticClass(void)" (__imp_?GetPrivateStaticClass@UObject@@CAPEAVUClass@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl UUserWidget::UUserWidget(class FVTableHelper &)" (__imp_??0UUserWidget@@QEAA@AEAVFVTableHelper@@@Z) referenced in function "class UObject * __cdecl InternalVTableHelperCtorCaller<class UExampleWidget>(class FVTableHelper &)" (??$InternalVTableHelperCtorCaller@VUExampleWidget@@@@YAPEAVUObject@@AEAVFVTableHelper@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl UUserWidget::~UUserWidget(void)" (__imp_??1UUserWidget@@UEAA@XZ) referenced in function "public: virtual __cdecl UExampleWidget::~UExampleWidget(void)" (??1UExampleWidget@@UEAA@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl UUserWidget::UUserWidget(class FObjectInitializer const &)" (__imp_??0UUserWidget@@QEAA@AEBVFObjectInitializer@@@Z) referenced in function "void __cdecl InternalConstructor<class UExampleWidget>(class FObjectInitializer const &)" (??$InternalConstructor@VUExampleWidget@@@@YAXAEBVFObjectInitializer@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UUserWidget(void)" (__imp_?Z_Construct_UClass_UUserWidget@@YAPEAVUClass@@XZ) referenced in function "void __cdecl `dynamic initializer for 'public: static class UObject * (__cdecl*const * const Z_Construct_UClass_UExampleWidget_Statics::DependentSingletons)(void)''(void)" (??__E?DependentSingletons@Z_Construct_UClass_UExampleWidget_Statics@@2QBQ6APEAVUObject@@XZB@@YAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::SetContentForSlot(class FName,class UWidget *)" (?SetContentForSlot@UUserWidget@@UEAAXVFName@@PEAVUWidget@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class UWidget * __cdecl UUserWidget::GetContentForSlot(class FName)const " (?GetContentForSlot@UUserWidget@@UEBAPEAVUWidget@@VFName@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::GetSlotNames(class TArray<class FName,class TSizedDefaultAllocator<32> > &)const " (?GetSlotNames@UUserWidget@@UEBAXAEAV?$TArray@VFName@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UWidget::BroadcastFieldValueChanged(struct UE::FieldNotification::FFieldId)" (?BroadcastFieldValueChanged@UWidget@@UEAAXUFFieldId@FieldNotification@UE@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UWidget::RemoveAllFieldValueChangedDelegates(void const *)" (?RemoveAllFieldValueChangedDelegates@UWidget@@UEAAHPEBX@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl UWidget::RemoveAllFieldValueChangedDelegates(struct UE::FieldNotification::FFieldId,void const *)" (?RemoveAllFieldValueChangedDelegates@UWidget@@UEAAHUFFieldId@FieldNotification@UE@@PEBX@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UWidget::RemoveFieldValueChangedDelegate(struct UE::FieldNotification::FFieldId,class FDelegateHandle)" (?RemoveFieldValueChangedDelegate@UWidget@@UEAA_NUFFieldId@FieldNotification@UE@@VFDelegateHandle@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FDelegateHandle __cdecl UWidget::AddFieldValueChangedDelegate(struct UE::FieldNotification::FFieldId,class TDelegate<void __cdecl(class UObject *,struct UE::FieldNotification::FFieldId),struct FNotThreadSafeNotCheckedDelegateUserPolicy>)" (?AddFieldValueChangedDelegate@UWidget@@UEAA?AVFDelegateHandle@@UFFieldId@FieldNotification@UE@@V?$TDelegate@$$A6AXPEAVUObject@@UFFieldId@FieldNotification@UE@@@ZUFNotThreadSafeNotCheckedDelegateUserPolicy@@@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::InitializeInputComponent(void)" (?InitializeInputComponent@UUserWidget@@MEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnMouseCaptureLost(struct FCaptureLostEvent const &)" (?NativeOnMouseCaptureLost@UUserWidget@@MEAAXAEBUFCaptureLostEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FCursorReply __cdecl UUserWidget::NativeOnCursorQuery(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnCursorQuery@UUserWidget@@MEAA?AVFCursorReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnTouchForceChanged(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnTouchForceChanged@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnMotionDetected(struct FGeometry const &,struct FMotionEvent const &)" (?NativeOnMotionDetected@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFMotionEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnTouchEnded(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnTouchEnded@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnTouchMoved(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnTouchMoved@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnTouchStarted(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnTouchStarted@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnTouchGesture(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnTouchGesture@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnDragCancelled(class FDragDropEvent const &,class UDragDropOperation *)" (?NativeOnDragCancelled@UUserWidget@@MEAAXAEBVFDragDropEvent@@PEAVUDragDropOperation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl UUserWidget::NativeOnDrop(struct FGeometry const &,class FDragDropEvent const &,class UDragDropOperation *)" (?NativeOnDrop@UUserWidget@@MEAA_NAEBUFGeometry@@AEBVFDragDropEvent@@PEAVUDragDropOperation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl UUserWidget::NativeOnDragOver(struct FGeometry const &,class FDragDropEvent const &,class UDragDropOperation *)" (?NativeOnDragOver@UUserWidget@@MEAA_NAEBUFGeometry@@AEBVFDragDropEvent@@PEAVUDragDropOperation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnDragLeave(class FDragDropEvent const &,class UDragDropOperation *)" (?NativeOnDragLeave@UUserWidget@@MEAAXAEBVFDragDropEvent@@PEAVUDragDropOperation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnDragEnter(struct FGeometry const &,class FDragDropEvent const &,class UDragDropOperation *)" (?NativeOnDragEnter@UUserWidget@@MEAAXAEBUFGeometry@@AEBVFDragDropEvent@@PEAVUDragDropOperation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnDragDetected(struct FGeometry const &,struct FPointerEvent const &,class UDragDropOperation * &)" (?NativeOnDragDetected@UUserWidget@@MEAAXAEBUFGeometry@@AEBUFPointerEvent@@AEAPEAVUDragDropOperation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnMouseButtonDoubleClick(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnMouseButtonDoubleClick@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnMouseWheel(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnMouseWheel@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnMouseLeave(struct FPointerEvent const &)" (?NativeOnMouseLeave@UUserWidget@@MEAAXAEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnMouseEnter(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnMouseEnter@UUserWidget@@MEAAXAEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnMouseMove(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnMouseMove@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnMouseButtonUp(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnMouseButtonUp@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnPreviewMouseButtonDown(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnPreviewMouseButtonDown@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnMouseButtonDown(struct FGeometry const &,struct FPointerEvent const &)" (?NativeOnMouseButtonDown@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFPointerEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnAnalogValueChanged(struct FGeometry const &,struct FAnalogInputEvent const &)" (?NativeOnAnalogValueChanged@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFAnalogInputEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnKeyUp(struct FGeometry const &,struct FKeyEvent const &)" (?NativeOnKeyUp@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFKeyEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnKeyDown(struct FGeometry const &,struct FKeyEvent const &)" (?NativeOnKeyDown@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFKeyEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnPreviewKeyDown(struct FGeometry const &,struct FKeyEvent const &)" (?NativeOnPreviewKeyDown@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFKeyEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnKeyChar(struct FGeometry const &,struct FCharacterEvent const &)" (?NativeOnKeyChar@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFCharacterEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FNavigationReply __cdecl UUserWidget::NativeOnNavigation(struct FGeometry const &,struct FNavigationEvent const &,class FNavigationReply const &)" (?NativeOnNavigation@UUserWidget@@MEAA?AVFNavigationReply@@AEBUFGeometry@@AEBUFNavigationEvent@@AEBV2@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FNavigationReply __cdecl UUserWidget::NativeOnNavigation(struct FGeometry const &,struct FNavigationEvent const &)" (?NativeOnNavigation@UUserWidget@@MEAA?AVFNavigationReply@@AEBUFGeometry@@AEBUFNavigationEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnRemovedFromFocusPath(struct FFocusEvent const &)" (?NativeOnRemovedFromFocusPath@UUserWidget@@MEAAXAEBUFFocusEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnAddedToFocusPath(struct FFocusEvent const &)" (?NativeOnAddedToFocusPath@UUserWidget@@MEAAXAEBUFFocusEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnFocusChanging(class FWeakWidgetPath const &,class FWidgetPath const &,struct FFocusEvent const &)" (?NativeOnFocusChanging@UUserWidget@@MEAAXAEBVFWeakWidgetPath@@AEBVFWidgetPath@@AEBUFFocusEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnFocusLost(struct FFocusEvent const &)" (?NativeOnFocusLost@UUserWidget@@MEAAXAEBUFFocusEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class FReply __cdecl UUserWidget::NativeOnFocusReceived(struct FGeometry const &,struct FFocusEvent const &)" (?NativeOnFocusReceived@UUserWidget@@MEAA?AVFReply@@AEBUFGeometry@@AEBUFFocusEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl UUserWidget::NativeSupportsKeyboardFocus(void)const " (?NativeSupportsKeyboardFocus@UUserWidget@@MEBA_NXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl UUserWidget::NativeIsInteractable(void)const " (?NativeIsInteractable@UUserWidget@@MEBA_NXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual int __cdecl UUserWidget::NativePaint(class FPaintArgs const &,struct FGeometry const &,class FSlateRect const &,class FSlateWindowElementList &,int,class FWidgetStyle const &,bool)const " (?NativePaint@UUserWidget@@MEBAHAEBVFPaintArgs@@AEBUFGeometry@@AEBVFSlateRect@@AEAVFSlateWindowElementList@@HAEBVFWidgetStyle@@_N@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeTick(struct FGeometry const &,float)" (?NativeTick@UUserWidget@@MEAAXAEBUFGeometry@@M@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeDestruct(void)" (?NativeDestruct@UUserWidget@@MEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativePreConstruct(void)" (?NativePreConstruct@UUserWidget@@MEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::NativeOnInitialized(void)" (?NativeOnInitialized@UUserWidget@@MEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::OnAnimationFinishedPlaying(class UUMGSequencePlayer &)" (?OnAnimationFinishedPlaying@UUserWidget@@MEAAXAEAVUUMGSequencePlayer@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::OnAnimationStartedPlaying(class UUMGSequencePlayer &)" (?OnAnimationStartedPlaying@UUserWidget@@MEAAXAEAVUUMGSequencePlayer@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::OnAnimationFinished_Implementation(class UWidgetAnimation const *)" (?OnAnimationFinished_Implementation@UUserWidget@@MEAAXPEBVUWidgetAnimation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::OnAnimationStarted_Implementation(class UWidgetAnimation const *)" (?OnAnimationStarted_Implementation@UUserWidget@@MEAAXPEBVUWidgetAnimation@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UUserWidget::Initialize(void)" (?Initialize@UUserWidget@@UEAA_NXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class TSharedPtr<class SWidget,1> __cdecl UWidget::GetAccessibleWidget(void)const " (?GetAccessibleWidget@UWidget@@MEBA?AV?$TSharedPtr@VSWidget@@$00@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class TSharedRef<class SWidget,1> __cdecl UWidget::RebuildDesignWidget(class TSharedRef<class SWidget,1>)" (?RebuildDesignWidget@UWidget@@MEAA?AV?$TSharedRef@VSWidget@@$00@@V2@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UUserWidget::OnWidgetRebuilt(void)" (?OnWidgetRebuilt@UUserWidget@@MEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class TSharedRef<class SWidget,1> __cdecl UUserWidget::RebuildWidget(void)" (?RebuildWidget@UUserWidget@@MEAA?AV?$TSharedRef@VSWidget@@$00@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UWidget::OnBindingChanged(class FName const &)" (?OnBindingChanged@UWidget@@MEAAXAEBVFName@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::OnDesignerChanged(struct FDesignerChangedEventArgs const &)" (?OnDesignerChanged@UUserWidget@@UEAAXAEBUFDesignerChangedEventArgs@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FText const __cdecl UUserWidget::GetPaletteCategory(void)" (?GetPaletteCategory@UUserWidget@@UEAA?BVFText@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FString __cdecl UWidget::GetLabelMetadata(void)const " (?GetLabelMetadata@UWidget@@UEBA?AVFString@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::SetDesignerFlags(enum EWidgetDesignFlags)" (?SetDesignerFlags@UUserWidget@@UEAAXW4EWidgetDesignFlags@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::SynchronizeProperties(void)" (?SynchronizeProperties@UUserWidget@@UEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class ULocalPlayer * __cdecl UUserWidget::GetOwningLocalPlayer(void)const " (?GetOwningLocalPlayer@UUserWidget@@UEBAPEAVULocalPlayer@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class APlayerController * __cdecl UUserWidget::GetOwningPlayer(void)const " (?GetOwningPlayer@UUserWidget@@UEBAPEAVAPlayerController@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UWidget::RemoveFromParent(void)" (?RemoveFromParent@UWidget@@UEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UWidget::IsHovered(void)const " (?IsHovered@UWidget@@UEBA_NXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::SetVisibility(enum ESlateVisibility)" (?SetVisibility@UUserWidget@@UEAAXW4ESlateVisibility@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UWidget::SetIsEnabled(bool)" (?SetIsEnabled@UWidget@@UEAAX_N@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::ReleaseSlateResources(bool)" (?ReleaseSlateResources@UUserWidget@@UEAAX_N@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UUserWidget::IsAsset(void)const " (?IsAsset@UUserWidget@@UEBA_NXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class UWorld * __cdecl UUserWidget::GetWorld(void)const " (?GetWorld@UUserWidget@@UEBAPEAVUWorld@@XZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UVisual::NeedsLoadForServer(void)const " (?NeedsLoadForServer@UVisual@@UEBA_NXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::PostDuplicate(bool)" (?PostDuplicate@UUserWidget@@UEAAX_N@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@UUserWidget@@UEAAXAEAUFPropertyChangedEvent@@@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UWidget::FinishDestroy(void)" (?FinishDestroy@UWidget@@UEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::BeginDestroy(void)" (?BeginDestroy@UUserWidget@@UEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::PostLoad(void)" (?PostLoad@UUserWidget@@UEAAXXZ)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UWidget::Modify(bool)" (?Modify@UWidget@@UEAA_N_N@Z)
11>ExampleWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UUserWidget::PreSave(class FObjectPreSaveContext)" (?PreSave@UUserWidget@@UEAAXVFObjectPreSaveContext@@@Z)
11>ExampleWidget.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) protected: virtual void __cdecl UUserWidget::NativeConstruct(void)" (__imp_?NativeConstruct@UUserWidget@@MEAAXXZ) referenced in function "protected: virtual void __cdecl UExampleWidget::NativeConstruct(void)" (?NativeConstruct@UExampleWidget@@MEAAXXZ)
11>C:\Users\RichardGotherstrom\Documents\Unreal Projects\MyProject\Binaries\Win64\UnrealEditor-MyProject.dll : fatal error LNK1120: 90 unresolved externals
11>
11>Error executing C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64\link.exe (tool returned code: 1120)
I have been searching for an answer on how to resolve but this but haven't really made any progress. The Unreal Engine version is 5.3 which is also specified in the Unreal Engine Project file here together with all the plugins:
{
"FileVersion": 3,
"EngineAssociation": "5.3",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "MyProject",
"Type": "Runtime",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "SunPosition",
"Enabled": true
},
{
"Name": "DataPrepEditor",
"Enabled": true
},
{
"Name": "DatasmithImporter",
"Enabled": true
},
{
"Name": "VariantManager",
"Enabled": true
},
{
"Name": "PythonScriptPlugin",
"Enabled": true
},
{
"Name": "HDRIBackdrop",
"Enabled": true
},
{
"Name": "SequencerScripting",
"Enabled": true
},
{
"Name": "DatasmithCADImporter",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64",
"Linux"
]
},
{
"Name": "InterchangeEditor",
"Enabled": true
},
{
"Name": "AxFImporter",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64"
]
},
{
"Name": "DatasmithRuntime",
"Enabled": true
},
{
"Name": "OpenXR",
"Enabled": true,
"SupportedTargetPlatforms": [
"Win64",
"Linux",
"Android",
"HoloLens"
]
}
]
}
I also tried retarget the solution to the sdk compatible with my operating system (windows 11). I also tried deleting folders and directories in the root project folder to "generate visual studio project files" by right clicking on the unreal engine project file -> show more options -> Generate visual studio project files. I'll also share all the components I have installed via the visual studio installer if that helps Installed components in visual studio
Help is super appreciated. If any more information is needed I'll provide it right away when asked. Thank you.
I think you're missing the step to update your <ProjectName>.Build.cs
with the dependencies on the UMG modules.
In HowTo_UMG.Build.CS, we need to add UMG to the list of included public modules, and Slate and SlateCore to the list of included private modules. We'll need to modify the first line in HowTo_UMG's constructor to read as follows:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
And then we can uncomment the following line:
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
In general when you hit an "unresolved external symbol" error when building a UE project and the error mentions an Unreal Engine C++ class (e.g. UWidget in this case) it means you're missing the right dependencies in your <ProjectName>.Build.cs
file.