menu
 

在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

0 投票
Hi, I've been challenging with callback function lately in C++. So far everything seemed okay, my code looks like the below. The problem is, whenever I try to cast UAkCallbackInfo* to UAkMarkerCallbackInfo, UAkDurationCallbackInfo or UAkMIDIEventCallbackInfo, it gives a linker error like this:

2>FireBase.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UAkMarkerCallbackInfo::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UAkMarkerCallbackInfo@@CAPEAVUClass@@XZ) referenced in function "public: void __cdecl AFireBase::CallbackFunc(enum EAkCallbackType,class UAkCallbackInfo *)" (?CallbackFunc@AFireBase@@QEAAXW4EAkCallbackType@@PEAVUAkCallbackInfo@@@Z)
2>E:\0_PROJECTS\TheVillage\Binaries\Win64\UnrealEditor-TheVillage.dll : fatal error LNK1120: 1 unresolved externals

The thing weird looking is, I can cast UAkCallbackInfo to UAkEventCallbackInfo, which is parent class for these three callbackinfo's I can't cast. I don't know where did I make it wrong, and having that linker error seems ridiculous.
- "AkAudio" is in the Build.cs
- I include AkGameplayStatics.h on the headers (other functions are working well, no problem at any events or rtpc stuff)

 

FireBase.h

#include "CoreMinimal.h"
#include "../Plugins/Wwise/Source/AkAudio/Classes/AkGameplayStatics.h"
#include "Particles/ParticleSystemComponent.h"
#include "GameFramework/Actor.h"
#include "FireBase.generated.h"

UCLASS()
class THEVILLAGE_API AFireBase : public AActor
{
    GENERATED_BODY()

    FOnAkPostEventCallback BindCallback;

public:    
    // Sets default values for this actor's properties
    AFireBase();

    UFUNCTION()
    void CallbackFunc(EAkCallbackType CallbackType, UAkCallbackInfo* CallbackInfo);
protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:    
    // Called every frame
    //virtual void Tick(float DeltaTime) override;

    UPROPERTY(EditAnywhere,BlueprintReadWrite,Category="FX")
    UParticleSystemComponent* BlueFireFX;

};

 

FireBase.cpp

#include "FireBase.h"

void AFireBase::BeginPlay()
{
    Super::BeginPlay();

    BindCallback.BindUFunction(this, "CallbackFunc");

    TArray<FAkExternalSourceInfo> nullSources;

    UAkGameplayStatics::PostEvent(nullptr, this, int32(EAkCallbackType::Marker), BindCallback, nullSources, false, (FString)("FireBase"));

    BlueFireFX->Deactivate();
    
}

void AFireBase::CallbackFunc(EAkCallbackType CallbackType, UAkCallbackInfo* CallbackInfo)
{
    UAkMarkerCallbackInfo* CBInfo = Cast<UAkMarkerCallbackInfo>(CallbackInfo);
}

 

Also, it doesn't give an error if I just declare UAkMarkerCallbackInfo* to anywhere, but if I use the class in Cast<>, it pops that error I mentioned above.
分类:General Discussion | 用户: omnisepher (190 分)
I'm having the same type of error:

  unresolved external symbol "private: static class UClass * __cdecl UAkDurationCallbackInfo::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UAkDurationCallbackInfo@@CAPEAVUClass@@XZ) referenced in function "public: void __cdecl AAkComponentPool::OnAkEventCallback(enum EAkCallbackType,class UAkCallbackInfo *,class UAkComponent *)" (?OnAkEventCallback@AAkComponentPool@@QEAAXW4EAkCallbackType@@PEAVUAkCallbackInfo@@PEAVUAkComponent@@@Z)

When I try to:

UAkDurationCallbackInfo* DurationCallbackInfo = Cast<UAkDurationCallbackInfo>(CallbackInfo);

Were you able to solve this?

Please sign-in or register to answer this question.

...