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"

Tutorial c++ code ended up with link error

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 );
 
 }



Product Version: Not Selected
Tags:
more ▼

asked May 04 '15 at 05:57 PM in C++ Programming

avatar image

zzAustin
1 2 2

avatar image kostor May 04 '15 at 06:25 PM

I understood almost nothing, but did you actually implement the function in cpp file?

avatar image zzAustin May 05 '15 at 02:03 AM

yes, the thing i did over and over is checking if the implementation matches the declaration. i even added __cdecl according to the error and still can't get pass.

i think UFUNCTION(BlueprintNativeEvent) actually did declare something, but i just don't know how can i implement it to match its form.

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

1 answer: sort voted first

There's a spelling error in your function declaration:

Instead of

 OnPickedup_Implementaion

it should be

 OnPickedup_Implementation

I think Blueprints specifically looks for the function "_Implementation"

more ▼

answered May 05 '15 at 06:45 AM

avatar image

staticvoidlol
2.6k 95 41 111

avatar image zzAustin May 05 '15 at 07:21 AM

staticvoidlol thanks for checking it for me, i will be more careful in the future

(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