C++ Why do i keep getting "inconsistent dll linkage error" on ACharacter::Jump

Here is my header file:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Components/InputComponent.h"
#include "GameFrameWork/Controller.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "CharachterMovement.generated.h"
bool jumpingDelay = false;
UCLASS()
class DODGY3D_API ACharachterMovement : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ACharachterMovement();
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
		USpringArmComponent* CameraBoom;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
		UCameraComponent* FollowCamera;
protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;
	void MoveForward(float Axis);
	void MoveRight(float Axis);
	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

};

Here is my cpp file:
// Fill out your copyright notice in the Description page of Project Settings.

#include "CharachterMovement.h"
#include "Engine/Engine.h"
#include <iostream>

// Sets default values
ACharachterMovement::ACharachterMovement()
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;
	GetCharacterMovement()->bOrientRotationToMovement = true;
	GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f);
	GetCharacterMovement()->JumpZVelocity = 300.f;
	GetCharacterMovement()->AirControl = 0.2f;

	CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
	CameraBoom->SetupAttachment(RootComponent);
	CameraBoom->TargetArmLength = 300.0f;
	CameraBoom->bUsePawnControlRotation = true;
	FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
	FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName);
	FollowCamera->bUsePawnControlRotation = false;

}

// Called when the game starts or when spawned
void ACharachterMovement::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void ACharachterMovement::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void ACharachterMovement::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
	PrimaryActorTick.bCanEverTick = true;

	PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
	PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
	if (jumpingDelay == false) {
		PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
	}
	PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);
	PlayerInputComponent->BindAxis("MoveForward", this, &ACharachterMovement::MoveForward);
	PlayerInputComponent->BindAxis("MoveRight", this, &ACharachterMovement::MoveRight);
	GetCharacterMovement()->bOrientRotationToMovement = true;
}

void ACharachterMovement::MoveRight(float Axis) {
	FRotator Rotation = Controller->GetControlRotation();
	FRotator YawRotation(0.0f, Rotation.Yaw, 0.0f);
	FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
	AddMovementInput(Direction, Axis);

}

void ACharachterMovement::MoveForward(float Axis) {
	FRotator Rotation = Controller->GetControlRotation();
	FRotator YawRotation(0.0f, Rotation.Yaw, 0.0f);
	FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
	AddMovementInput(Direction, Axis);

}

void ACharacter::Jump() {
	jumpingDelay = true;

}

You cannot do it this way:

void ACharacter::Jump() {
	jumpingDelay = true;

}

You have to override the method in ACharachterMovement

virtual void Jump() override;

Then in cpp:

void ACharachterMovement::Jump() {
    Super::Jump();
	jumpingDelay = true;

}

2 Likes

Thanks, sorry for the late reply. A few months ago I had removed windows and replaced it with Ubuntu (ue4 isnt available on Linux :frowning: ). Yesterday I bought a second hard drive so now im able get windows too in dual boot mode so i’m finally able to use ue4 again. Although I lost the project I was working on , I have gotten better at cpp by a lot and your reply is very logical. Thank you SolidGasStudio!