Hi,
I’m following the “3rd Person Power-up Game with C++” video, and I’m at the 3rd video writing the Pickup class,
i’m on 4.7.6, well i followed all the transion guide that i can find to correct the code incompatibility, but eventually I still get this link error :
unresolved external symbol “public: virtual void __cdecl APickUp::OnPickedup_Implementation(void)” (?OnPickedup_Implementation@APickUp@@UEAAXXZ),
and also a warning says “Function PickUp::OnPickedup needs native implementation by virtual void OnPickedup_Implementation() due to its properties” exists.
originally i didn’t declare "void OnPickedup_Implementaion(); " manually, in that case, one compile warning says that it would be generated by UHT but in next version it should be declared manually, and then another error followed saying my “OnPickedup_Implementaion” is not declared which prevents me from advancing, so i searched and followed another thread which added the declaration manually and then ended up with the link error. really appreciate if someone can help me take a look:
Here’s the my code:
PickUp.h:
#pragma once
#include "GameFramework/Actor.h"
#include "PickUp.generated.h"
UCLASS()
class POWERUPDEMO_API APickUp : public AActor
{
GENERATED_BODY()
public:
APickUp();
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
//This one is added manually by Austin
APickUp(const FObjectInitializer &ObjectInitializer);
//Customized properties by Austin
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
bool bIsActive;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
USphereComponent* BaseCollisionComponent;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
UStaticMeshComponent* PickupMesh;
UFUNCTION(BlueprintNativeEvent)
void OnPickedup();
virtual void OnPickedup_Implementaion();
};
PickUp.cpp:
#include "PowerUpDemo.h"
# include "PickUp.h"
APickUp::APickUp()
{
PrimaryActorTick.bCanEverTick = true;
}
APickUp::APickUp(const FObjectInitializer &PCIP)
:Super(PCIP)
{
bIsActive = true;
BaseCollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("AustinBaseSphereComponent"));
RootComponent = BaseCollisionComponent;
PickupMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("AustinPickupMesh"));
PickupMesh->SetSimulatePhysics(true);
PickupMesh->AttachTo(RootComponent);
}
void APickUp::OnPickedup_Implementaion()
{
}
void APickUp::BeginPlay()
{
Super::BeginPlay();
}
void APickUp::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}