I'm trying to implement a window-moving function using the MoveWindowTo function in a game I'm making with Unreal Engine. However, I get the following error:
undefined symbols for architecture arm64:
"SWindow::MoveWindowTo(UE::Slate::FDeprecateVector2DParameter NewPosition)", referenced from:
AMyGameModeBase::AMyGameModeBase() in MyGameModeBase.cpp.o
ld: symbol(s) not found for architecture arm64
What should I do?
My code:
**MyGameModeBase and MyGame isn't real name
MyGameModeBase.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "MyGameModeBase.generated.h"
/**
*
*/
UCLASS()
class MYGAME_API AMyGameModeBase : public AGameModeBase
{
GENERATED_BODY()
public:
AMyGameModeBase();
};
MyGameModeBase.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyGameModeBase.h"
AMyGameModeBase::AMyGameModeBase()
{
//For testing window position changes
sleep(1000);
if (GEngine && GEngine->GameViewport)
{
FVector2D WindowPosition = FVector2D(400.f, 300.f);
GEngine->GameViewport->GetWindow()->MoveWindowTo(WindowPosition);
}
}
My develop computer:
iMac 24
ram: 16GB
OS: MacOS Seqouia 15.2
My IDE:
rider 2024.3.5
I googled and checked the Unreal Engine source code, but I couldn't find the error.
I changed my IDE, but it couldn't work
I'm trying to implement a window-moving function using the MoveWindowTo function in a game I'm making with Unreal Engine. However, I get the following error:
undefined symbols for architecture arm64:
"SWindow::MoveWindowTo(UE::Slate::FDeprecateVector2DParameter NewPosition)", referenced from:
AMyGameModeBase::AMyGameModeBase() in MyGameModeBase.cpp.o
ld: symbol(s) not found for architecture arm64
What should I do?
My code:
**MyGameModeBase and MyGame isn't real name
MyGameModeBase.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "MyGameModeBase.generated.h"
/**
*
*/
UCLASS()
class MYGAME_API AMyGameModeBase : public AGameModeBase
{
GENERATED_BODY()
public:
AMyGameModeBase();
};
MyGameModeBase.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyGameModeBase.h"
AMyGameModeBase::AMyGameModeBase()
{
//For testing window position changes
sleep(1000);
if (GEngine && GEngine->GameViewport)
{
FVector2D WindowPosition = FVector2D(400.f, 300.f);
GEngine->GameViewport->GetWindow()->MoveWindowTo(WindowPosition);
}
}
My develop computer:
iMac 24
ram: 16GB
OS: MacOS Seqouia 15.2
My IDE:
rider 2024.3.5
I googled and checked the Unreal Engine source code, but I couldn't find the error.
I changed my IDE, but it couldn't work
Share Improve this question edited Mar 16 at 15:10 김범준 asked Mar 16 at 15:06 김범준김범준 112 bronze badges 1- You are building for ARM 64. Do you have tools (compilers, etc.) installed for that target architecture? – kiner_shah Commented Mar 16 at 15:26
1 Answer
Reset to default 0Since the linker error refers to SWindow::MoveWindowTo
, I searched for that in my IDE and found it's defined in:
Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp
^^^^^^^^^
This is in the SlateCore
module. What you need to do then is modify your Build.cs
to link against SlateCore
.
Something like this:
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore", // <-- add this
})
After you do that, Generate Project Files, then build again.
Rinse and repeat for all other linker errors until the game links successfully.
Note that sometimes you want to add to PublicDependencyModuleNames
and sometimes to PrivateDependencyModuleNames
, it depends whether you need access to the Public
or the Private
code in that module.