KCoppinsIventis
Topic Author
Posts: 11
Joined: 14 Mar 2024, 19:53

UNoesisInstance::GetCachedWidget causes linker error

21 Mar 2024, 20:18

Hi there,

I am trying to get the cached widget to set my input mode in C++:
auto InputMode = FInputModeUIOnly();
InputMode.SetWidgetToFocus(NoesisInstance->GetCachedWidget());
UserController->SetInputMode(InputMode);
However this causes the following linker error:
unresolved external symbol "__declspec(dllimport) public: class TSharedPtr<class SWidget,1> __cdecl UWidget::GetCachedWidget(void)const " (__imp_?GetCachedWidget@UWidget@@QEBA?AV?$TSharedPtr@VSWidget@@$00@@XZ) referenced in function "public: void __cdecl UMainViewModel::ToggleLocationSelector(void)" (?ToggleLocationSelector@UMainViewModel@@QEAAXXZ)
I have tried including the following headers in both my header and main file:
#include "NoesisRuntime.h"
#include "Widgets/SUserWidget.h"
#include "Blueprint/UserWidget.h"
#include "Widgets/SWidget.h"
#include "Components/Widget.h"
Which header am I missing or is there something else here entirely? Thanks for any help!
 
KCoppinsIventis
Topic Author
Posts: 11
Joined: 14 Mar 2024, 19:53

Re: UNoesisInstance::GetCachedWidget causes linker error

22 Mar 2024, 10:19

I have figured out my issue, nothing with NoesisGUI. I just had to include the UMG public dependency module in my module's build.cs:
PublicDependencyModuleNames.AddRange(new string[] {  "UMG" });
 
User avatar
sfernandez
Site Admin
Posts: 2997
Joined: 22 Dec 2011, 19:20

Re: UNoesisInstance::GetCachedWidget causes linker error

26 Mar 2024, 17:56

Thanks for sharing the solution, even if it wasn't a Noesis issue :)

Who is online

Users browsing this forum: Bing [Bot] and 2 guests