x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Vtable compiler error

Undefined symbols for architecture x86_64: "vtable for ATest2Character", referenced from: ATest2Character::ATest2Character() in Test2Character.cpp.o ATest2Character::ATest2Character(FVTableHelper&) in Test2Character.gen.cpp.o ATest2Character::ATest2Character(FVTableHelper&) in Test2Character.gen.cpp.o ATest2Character::__VTableCtorCaller(FVTableHelper&) in Test2Character.gen.cpp.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Command /Users/Shared/Epic Games/UE_4.22/Engine/Build/BatchFiles/Mac/XcodeBuild.sh failed with exit code 5

I started following a tutorial and the compiler started not liking code that was already put in and it worked before. This is code the unreal engine had already put in (thirdperson character template) and idk what to do, ive been stuck on this for about 3 days now. Note, i did add health functions because im trying to add health and a stamina bar, maybe im going about it the wrong way and it doesnt like it. Im not sure. Ill post the code here: // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.

pragma once

include "Core.h"

include "GameFramework/Character.h" #include "Test2Character.generated.h"

UCLASS(config=Game) class ATest2Character : public ACharacter { GENERATED_BODY()

 /** Camera boom positioning the camera behind the character */
 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
 class USpringArmComponent* CameraBoom;

 /** Follow camera */
 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
 class UCameraComponent* FollowCamera;

public: ATest2Character();

 virtual void Tick(float DeltaTime) override;

 /** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */
 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
 float BaseTurnRate;

 /** Base look up/down rate, in deg/sec. Other scaling may affect final rate. */
 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
 float BaseLookUpRate;
 

private: //Character Attributes UPROPERTY(EditAnywhere,Category=Attributes) float Health = 1.0f; UPROPERTY(EditAnywhere,Category=Attributes) float Stamina = 1.0f; UPROPERTY(EditAnywhere,Category=Attributes) FString PlayerName = ""; protected:

 /** Resets HMD orientation in VR. */
 void OnResetVR();

 /** Called for forwards/backward input */
 void MoveForward(float Value);

 /** Called for side to side input */
 void MoveRight(float Value);

 /** 
  * Called via input to turn at a given rate. 
  * @param Rate    This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
  */
 void TurnAtRate(float Rate);

 /**
  * Called via input to turn look up/down at a given rate. 
  * @param Rate    This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
  */
 void LookUpAtRate(float Rate);

 /** Handler for when a touch input begins. */
 void TouchStarted(ETouchIndex::Type FingerIndex, FVector Location);

 /** Handler for when a touch input stops. */
 void TouchStopped(ETouchIndex::Type FingerIndex, FVector Location);

public: //get health and stamina functions UFUNCTION(Blueprintpure, category = Attributes) float GetHealth(); UFUNCTION(Blueprintpure, category = Attributes) float GetStamina(); UFUNCTION(Blueprintpure, category = Attributes) float GetCurrentHealth(); UFUNCTION(Blueprintpure, category = Attributes) float GetCurrentStamina(); UFUNCTION(Blueprintpure, category = Attributes) FString GetPlayerName();

protected: // APawn interface virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; // End of APawn interface

public: / Returns CameraBoom subobject / FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; } / Returns FollowCamera subobject / FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; } };

never touched any Virtutal functions nor any VTables its talking about. I tried to figure this out on my own but its getting out of hand. Please help!

Product Version: UE 4.22
Tags:
more ▼

asked May 22 '19 at 01:44 PM in C++ Programming

avatar image

Matgarciaz
3 1 3

avatar image ExtraLifeMatt May 22 '19 at 03:05 PM

You have 1 virtual method in there:

 protected: // APawn interface 
 virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; // End of APawn interface

Do you have a body defined for that method?

avatar image Matgarciaz May 23 '19 at 10:51 AM

Yes here it is:

void ATest2Character::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) { // Set up gameplay key bindings check(PlayerInputComponent); PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump); PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);

 PlayerInputComponent->BindAxis("MoveForward", this, &ATest2Character::MoveForward);
 PlayerInputComponent->BindAxis("MoveRight", this, &ATest2Character::MoveRight);

 // We have 2 versions of the rotation bindings to handle different kinds of devices differently
 // "turn" handles devices that provide an absolute delta, such as a mouse.
 // "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick
 PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
 PlayerInputComponent->BindAxis("TurnRate", this, &ATest2Character::TurnAtRate);
 PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
 PlayerInputComponent->BindAxis("LookUpRate", this, &ATest2Character::LookUpAtRate);

 // handle touch devices
 PlayerInputComponent->BindTouch(IE_Pressed, this, &ATest2Character::TouchStarted);
 PlayerInputComponent->BindTouch(IE_Released, this, &ATest2Character::TouchStopped);

 // VR headset functionality
 PlayerInputComponent->BindAction("ResetVR", IE_Pressed, this, &ATest2Character::OnResetVR);

}

its straight from unreal so im confused as to why it would be upset with this code

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Omg i got it, i had added a virtual void and i didnt define it, thank god i found it. Thank you! You helped because now i was looking specifically for virtual voids i had

more ▼

answered May 22 '19 at 08:21 PM

avatar image

Matgarciaz
3 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question