hello there, i’m trying to make my game’s UI in c++ with Slate and UMG, but i’m having some problems with UserWidget Class.
these are the steps that i took till now:
- Added Slate, SlateCore to Private and **UMG **(i also tried without adding UMG) to Public Dependencies in Build.cs.
- Checked the **Projects Included Directories **to assure Slate, SlateCore and UMG are in there, which they where.
- cleaning the solution and deleting “Binaries” and “Intermediate” Directories in Project Files And **Rebuilding **The Project completely. (i even once rebuilt the Engine itself)
- including related header files to the UserWidget file (also tried without including them).
- i made a new empty project in unreal and did all of above again (bunch of times!)
after 2 days and lots of frustration i still get this **error **in Visual Studio, (version of UE is **4.25.3 **with visual studio community 2019):
mainMenuWidget.gen.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl UmainMenuWidget::NativeConstruct(void)" (?NativeConstruct@UmainMenuWidget@@MEAAXXZ)
my main purpose was overriding Tick function but as you can’t override tick itself (not virtual) i tried **NativeTick **(also NativeConstruct ect…) and still got the error.
Project.Build.cs:
using UnrealBuildTool;
public class slateUMGuiTest : ModuleRules
{
public slateUMGuiTest(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });
}
}
mainMenuWidget.cpp:
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "mainMenuWidget.generated.h"
UCLASS()
class SLATEUMGUITEST_API UmainMenuWidget : public UUserWidget
{
GENERATED_BODY()
protected:
virtual void NativeConstruct() override;
};
can someone please help?