I did a lot of googling about LNK1120 and LNK 2019. Yet I cannot grasp what is the problem.
I am still stuck at this error message.
CompilerResultsLog: Error: NCFT_PlayerController.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: class ABase_Character * __cdecl UCharacterManager::GetTheCharacterByIndex(int,enum EUnitTypeEnum)” (_imp?GetTheCharacterByIndex@UCharacterManager@@QEAAPEAVABase_Character@@HW4EUnitTypeEnum@@@Z) referenced in function “public:
void __cdecl ANCFT_PlayerController::GetThePlayerCharacter(void)” (?GetThePlayerCharacter@ANCFT_PlayerController@@QEAAXXZ)
I checked whether I missed Classname:: and constructors. but i am pretty sure it is solid.
Sign… I have short time and it bugs me pretty bad.
here goes codes.
NCFT_GameController.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "EnumHeader.h"
#include "Base_Character.h"
#include "NCFT_PlayerController.generated.h"
UCLASS()
class NOCOUNTRYFORTHEM415_API ANCFT_PlayerController : public APlayerController
{
public:
ANCFT_PlayerController(const FObjectInitializer& ObjectInitializer);
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Controll a player Unit")
class ABase_Character* theControllableCharacter;
UFUNCTION(BlueprintCallable, Category = "Controll a player Unit")
void GetThePlayerCharacter();
//and the rest of code goes...
}
#include "NoCountryForThem415.h"
#include "NCFTGameInstance.h"
#include "NCFT_PlayerController.h"
ANCFT_PlayerController::ANCFT_PlayerController(const FObjectInitializer& ObjectInitializer)
:Super(ObjectInitializer)
{
theControllableCharacter = NULL;
}
void ANCFT_PlayerController::GetThePlayerCharacter()
{
UNCFTGameInstance* instance = Cast<UNCFTGameInstance>(UGameplayStatics::GetGameInstance(this));
if (instance)
{
if (theControllableCharacter == NULL)
{
//the code that cause the problem.
theControllableCharacter =instance->CharactersManager->GetTheCharacterByIndex(0, EUnitTypeEnum::UTE_PLAYER);
}
}
}
CharacterManager.h
#pragma once
#include "NoCountryForThem415/Public/EnumHeader.h"
#include "UObject/NoExportTypes.h"
#include "Base_Character.h"
#include "Character_Stat.h"
#include "CharacterManager.generated.h"
//it is in Different API Module, but The Game Instance has it as SubOject.
UCLASS(Blueprintable, BlueprintType)
class NCFT_CHARACTERS_API UCharacterManager : public UObject
{
GENERATED_BODY()
public:
UCharacterManager(const FObjectInitializer& ObjectInitializer);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Current PlayerUnits Party")
TArray<class ABase_Character*> PlayerUnits;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Current EnemyUnits Party")
TArray<class ABase_Character*> EnemyUnits;
//UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Current EnemyUnits Party")
// int m_iCreatedEnemyIndex;
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Datas in Battle")
class ABase_Character* GetTheCharacterByIndex(int index, EUnitTypeEnum _type);
}
CharacterManager.cpp
#include "NCFT_Characters.h"
#include "CharacterManager.h"
UCharacterManager::UCharacterManager(const FObjectInitializer& ObjectInitializer)
:Super(ObjectInitializer)
{
}
class ABase_Character* UCharacterManager::GetTheCharacterByIndex(int index, EUnitTypeEnum _type)
{
switch (_type)
{
case EUnitTypeEnum::UTE_PLAYER:
{
if (PlayerUnits.Num() <= index) return NULL;
return PlayerUnits[index];
}
case EUnitTypeEnum::UTE_ENEMY:
{
if (EnemyUnits.Num() <= index) return NULL;
return EnemyUnits[index];
}
default:
{
break;
}
}
return NULL;
}
and lastly my project build.cs
using UnrealBuildTool;
public class NoCountryForThem415 : ModuleRules
{
public NoCountryForThem415(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "UMG", "Slate", "SlateCore", "RHI", "RenderCore", "ShaderCore", "NCFT_Battles", "NCFT_Characters" });
//PrivateDependencyModuleNames.AddRange(new string] { });
// Uncomment if you are using Slate UI
PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
Sign… somebody help me…