Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

0 votes
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.
in General Discussion by omnisepher (190 points)
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.

...