Hi, I have created a project using the blank C++ template and am trying to create a custom widget and put it into a HUD.
When compiling from XCode or Unreal editor, I get the error:
Undefined symbols for architecture x86_64:
"SSettingsWindow::Construct(SSettingsWindow::FArguments const&)", referenced from:
AMasterRobotHUD::buildControlPanels() in MasterRobotHUD.cpp.o
I am using Unreal 4.14 and XCode 8 on MacOS Sierra.
This is how I am adding the widget to a subclass of AHUD:
GEngine->GameViewport->AddViewportWidgetContent(
SNew(SWeakWidget)
.PossiblyNullContent(settingsWindow.ToSharedRef())
);
This is how the class for settingsWindow looks like. .h file:
#pragma once
#include "Widgets/SCompoundWidget.h"
class AMasterRobotHUD;
/**
*
*/
class THEHIVEMIND_API SSettingsWindow : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SSettingsWindow)
: _ownerHUD()
{}
SLATE_ARGUMENT(TWeakObjectPtr<AMasterRobotHUD>, ownerHUD)
SLATE_END_ARGS()
/** Constructs this widget with InArgs */
void Construct(const FArguments& InArgs);
};
And cpp file:
#include "TheHiveMind.h"
#include "SSettingsWindow.h"
#include "SlateOptMacros.h"
void SSettingsWindow::Construct(const FArguments& InArgs)
{
/*ChildSlot
[
// Populate the widget
];*/
}
This is in my build.cs file:
PublicDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject",
"Engine",
"InputCore"
}
);
PrivateDependencyModuleNames.AddRange(
new string[] {
"Slate",
"SlateCore"
}
);
I have tried editing the build.cs file, then clicking “Refresh XCode project” in the Unreal editor, with no luck. Am I missing something else that needs to be done?