Hi all, I’m getting this issue at compile time and have no idea why:
Error:
LNK2019: unresolved external symbol "__declspec(dllimport) public: class USkeletalMeshSocket * __cdecl USkinnedMeshComponent::GetSocketByName(class FName)const " (_imp ?GetSocketByName@USkinnedMeshComponent@@QEBAPEAVUSkeletalMeshSocket @@VFName @@@Z ) referenced in function “public: virtual void __cdecl AItemBase::CollectItem(void)” (?CollectItem@AItemBase@@UEAAXXZ )
This is the culprit method in my class:
void AItemBase::CollectItem()
{
if (!GameInstanceRef) return;
BaseMesh->SetCollisionResponseToChannel(ECC_Camera, ECR_Ignore);
BaseMesh->SetCollisionResponseToChannel(ECC_Pawn, ECR_Ignore);
BaseMesh->SetSimulatePhysics(false);
APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
if(ALLPlayer* Olivia = Cast<ALLPlayer>(PlayerPawn))
{
DisableCollisions();
PlayQuipSound();
bRotate = false;
if (ItemInstanceEffect)
ItemInstanceEffect->Deactivate();
Olivia->InventoryItems.AddInventoryItem(UniqueName, this);
GameInstanceRef->TriggerInventoryUpdated(this->UniqueName);
const USkeletalMeshSocket* SMesh = Olivia->GetMesh()->GetSocketByName("RightHandSocket");
if (SMesh)
SMesh->AttachActor(this, Olivia->GetMesh());
Olivia->InventoryItems.HideAllHandItems();
Olivia->InventoryItems.RightHandSocketRef = this;
ShowInHand();
Olivia->InteractableItemRef = nullptr;
}
}
I have the appropriate include too:
#include “Engine/SkeletalMeshSocket.h”
This is so frustrating that I’m about to throw in the towel. Any ideas please?
Thank you
Hi Joofvllle1,
Try wrapping the “RightHandSocket” with “TEXT(“RightHandSocket”)” - it may be getting confused with you passing a single-byte string in rather than unicode.
Thanks for the idea, tried it and the problem persists.
The USkinnedMeshComponent is part of the engine module, the unresolved external symbol error is usually given when you forget to define a function or an engine module you are using is not included. Check your .Build.cs file if PublicDependencyModuleNames includes “Engine”
Hi, these are the contents of my build.cs file
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class LiviLocket : ModuleRules
{
public LiviLocket(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore", "Niagara" });
}
}
So I’ve tried a couple of things and still no result, this is the extent of the error I get.
Creating library D:\development\unreal\LiviLocket\Intermediate\Build\Win64\UnrealEditor\Development\LiviLocket\UnrealEditor-LiviLocket.suppressed.lib and object D:\development\unreal\LiviLocket\Intermediate\Build\Win64\UnrealEditor\Development\LiviLocket\UnrealEditor-LiviLocket.suppressed.exp
ItemBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class USkeletalMeshSocket * __cdecl USkinnedMeshComponent::GetSocketByName(class FName)const " (__imp_?GetSocketByName@USkinnedMeshComponent@@QEBAPEAVUSkeletalMeshSocket@@VFName@@@Z) referenced in function "public: virtual void __cdecl AItemBase::CollectItem(void)" (?CollectItem@AItemBase@@UEAAXXZ) [D:\development\unreal\LiviLocket\Intermediate\ProjectFiles\LiviLocket.vcxproj]
D:\development\unreal\LiviLocket\Binaries\Win64\UnrealEditor-LiviLocket.dll : fatal error LNK1120: 1 unresolved externals [D:\development\unreal\LiviLocket\Intermediate\ProjectFiles\LiviLocket.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles\Build.bat" LiviLocketEditor Win64 Development -Project="D:\development\unreal\LiviLocket\LiviLocket.uproject" -WaitMutex -FromMsBuild" exited with code 6. [D:\development\unreal\LiviLocket\Intermediate\ProjectFiles\LiviLocket.vcxproj]
Done Building Project "D:\development\unreal\LiviLocket\Intermediate\ProjectFiles\LiviLocket.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\development\unreal\LiviLocket\LiviLocket.sln" (Games\LiviLocket target(s)) -- FAILED.
I’ve added “Engine” to the build file:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });
It seems it just doesn’t get where USkeletalMeshSocket is!
Yes most strange! The only other thing I can think of apart from re-downloading the UE source is to add the “Engine” module to the PrivateDependencyModuleNames as well/instead…
So I uninstalled the engine and reinstalled it and that worked! Finally!
Thanks for the tip appreciate it.
1 Like
Raver460
(Raver460)
February 19, 2023, 11:53pm
10
As in you uninstalled unreal engine itself to solve the problem