I can’t figure this out.
Using SetViewModel from UMVVMView in C++ used to work in 5.0.
Then I updated it to 5.3, and now I get an unresolved external symbol.
The problem seems to be when trying to cast my view to a TScriptInterface
TScriptInterface<INotifyFieldValueChanged> xx = _myView;
As soon as that line is active, I get
Link [x64] UnrealEditor-MyGame-Win64-DebugGame.dll
Creating library G:\Unreal Projects\MyGame\BattleStarGalactica\MainGame - 5.3\Intermediate\Build\Win64\x64\UnrealEditor\DebugGame\MyGame\UnrealEditor-MyGame-Win64-DebugGame.sup.lib and object G:\Unreal Projects\MyGame\BattleStarGalactica\MainGame - 5.3\Intermediate\Build\Win64\x64\UnrealEditor\DebugGame\MyGame\UnrealEditor-MyGame-Win64-DebugGame.sup.exp
10>WCharacterInfo.cpp.obj: Error LNK2019 : unresolved external symbol "__declspec(dllimport) private: static class UClass * __cdecl UNotifyFieldValueChanged::GetPrivateStaticClass(void)" (__imp_?GetPrivateStaticClass@UNotifyFieldValueChanged@@CAPEAVUClass@@XZ) referenced in function "public: __cdecl TScriptInterface<class INotifyFieldValueChanged>::TScriptInterface<class INotifyFieldValueChanged><class UWSelectButton_VM>(struct TObjectPtr<class UWSelectButton_VM>)" (??$?0VUWSelectButton_VM@@@?$TScriptInterface@VINotifyFieldValueChanged@@@@QEAA@U?$TObjectPtr@VUWSelectButton_VM@@@@@Z)
Hint on symbols that are defined and could potentially match:
"__declspec(dllimport) private: static class UClass * __cdecl AAIController::GetPrivateStaticClass(void)" (__imp_?GetPrivateStaticClass@AAIController@@CAPEAVUClass@@XZ)
"__declspec(dllimport) private: static class UClass * __cdecl AActor::GetPrivateStaticClass(void)" (__imp_?GetPrivateStaticClass@AActor@@CAPEAVUClass@@XZ)
...
10>UnrealEditor-MyGame-Win64-DebugGame.dll: Error LNK1120 : 1 unresolved externals
I tried all suggestions related to the “unresolved external symbol” error message that I can find on all the forums and sites (even though some do not seem relevant), but none seem to fix the problem.
I tried adding ModelViewViewModel to the Build.cs (although MVVM is a plugin). The plugin is activated. I did several regens and full builds and everything I could find. All my functions are implemented. And the viewModel is an engine plugin.
It works when going through the blueprints, as my current workaround is that I created a Blueprint-implementable event function with a view model as an argument. I then set the view model in the blueprint using the setviewmodel blue print node. That works, but I still want to know: How do I set a view Model in C++?
I even tried to use the same code in the LyriaStarterGame from Epic and I get the same errors there.
Any advice?