I am not sure what the problem is.
I just noticed you wrote *" i have tried adding this line of code in the public section of the AActor class in Actor.h" *
Are you editing the Actor class itself?
You should not edit the actor class.
You should create a child class and work on that
create a MyActor class that derives from Actor.
You can do that in the editor / content browser / new C++ class / Parent Class Actor
that should open up both your New Class Header and CPP file in Visual Studio
Compile them with no changes.
Then add the function declaration like you did to the .h file and the prototype to .cpp it should work.