Using multicast delegates on a c++ class that is not a UClass

I have declared a multicast delegate in the following fashion in header file

DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnActivationComplete);

class MyGame_API UMyClassComponent
{
};

It shows me the following compilation error in .generated.cpp

Use of undeclared identifer
UClass* OuterClass=Z_Construct_UClass_UMyClassComponent();

The above problems still remains but I found a workaround. If I use DECLARE_DELEGATE or DECLARE_EVENT it works on a non UClass class. It allows me to broadcast the event. The problem that I am having now is listening the event in my Actor sub class.

I tried using AddRaw(this, &MyActorSubclass::MyFunction) - but it fails with ‘no such method definition for AddRaw’. I dont understand why this fails to compile?? (MyFunction is not a UFUNCTION).
Can someone please let me know the correct way of achieving this?

I also tried AddSP() but unfortunately TSharedFromThis is not allowed on Actor sub classes. So cant use this.

EDIT: Updated the question with my most recent findings.

There are a few issues. You shouldn’t prefix your class with U if you are not UObject derived. Since you are naming it UMyClassComponent, then I am assuming you have a UObject based class derived from some UInsertHereComponent. Your error Z_Construct etc, just tells you that you are missing UCLASS / GENERATED_UCLASS_BODY etc. To make delegate work with this setup use AddUObject .

If you have a plain class, not UObject derived, say FMySomething, then the following will work:

struct FMySomething
{
    FSimpleMulticastDelegate OnFoo;
    void Callback();
};

then to Add:  OnFoo.AddRaw(this, &FMySomething::Callback);

Hope this helps.

Thanks! Using AddUObject seems to work fine. I tried all other methods except this one :p.

PS: I should definitely rename my class. It started out as a subclass of USceneComponent but then I converted it into a regular c++ class. The name remained for some reason.