Linker Problems

I fixed all issues with the forward declarations in the code.
Unreal compiles no Error and game works fine, Visual studio has 4 errors i can not get fixed.

Image here: http://foto.arcor-online.net/palb/alben/97/800997/3332613665666232.jpg

Each time i compile in VS with the Errors, in UE Editor the compile button is vanished.
Reloading helps…

Update: Iresetted the project with Source Tree to a former state, but i still get the same error at the same stage of the project again.

In lecture 130, where the ELEVATE method is added: ( Barrel->ElevateBarrel(5.0f); )

**TankAimingComponent.cpp**
    void UTankAimingComponent::MoveBarrelTowards(FVector AimDirection)
    {
        auto BarrelRotator = Barrel->GetForwardVector().Rotation();
        auto AimAsRotator = AimDirection.Rotation();
        auto DeltaRotator = AimAsRotator - BarrelRotator;
        Barrel->ElevateBarrel(5.0f);
    }

Hier is my Header of the TankBarrel:
UTankBarrel.h
#pragma once
#include “Components/StaticMeshComponent.h”
#include “UTankBarrel.generated.h”

UCLASS()
class BATTLETANKS_API UUTankBarrel : public UStaticMeshComponent
{
    GENERATED_BODY()

public:
    void ElevateBarrel(float DegreesPerSecond);
}

and this is the .cpp:
UTankBarrel.cpp

#include "BattleTanks.h"
#include "UTankBarrel.h"

void ElevateBarrel(float DegreesPerSecond)
{
};

Whatever i do, i get a LNK2019 error: https://msdn.microsoft.com/de-de/library/799kze2z.aspx

I did a lot of reaerch on the web, but i can not get a solution for this myself.

Update: Finally, the Error appears in UE4 too when compiling:

CompilerResultsLog:Error: Error TankAimingComponent.cpp.obj : error LNK2019: Verweis auf nicht aufgel?stes externes Symbol ““public: void __cdecl UUTankBarrel::ElevateBarrel(float)” (?ElevateBarrel@UUTankBarrel@@QEAAXM@Z)” in Funktion "“public: void __cdecl UTankAimingComponent::MoveBarrelTowards(struct FVector)” (?MoveBarrelTowards@UTankAimingComponent@@QEA
AXUFVector@@@Z)".
CompilerResultsLog:Error: Error D:\VS_C++\Tutorials\Section04_BattleTanks\BattleTanks\Binaries\Win64\UE4Editor-BattleTanks-5318.dll : fatal error LNK1120: 1 nicht aufgel?ste Externe

Please, can anyone help me out of this ?

You didn’t specify the class (UUTankBarrel::) in the UTankBarrel.cpp

void UUTankBarrel::ElevateBarrel(float DegreesPerSecond)
{
}

There might also be a problem with your AimAt function.

Hi DanM,

that is the solution, i did not qualify the class in the cpp
.
I (shame on me) did not see this quite obvious flaw in the code and lost myself digging for hours into the web finding something about the Linker error.

Thanks a lot.

Privacy & Terms