Unresolved External Symbol When Trying to Create an Abstract Actor Class With a Pure Virtual Function
So, I'm trying to create an interface class called 'AInteractableActor' which contains a pure virtual method named 'Interact()' so that I can easily add interactable actors to my game without having to program an individual cast for each type of actor I want to be able to interact with inside my PlayerCharacter class.
However, when I compile my code I'm given a linking error to do with an unresolved external symbol. This is the error output from VS:
As far as I can tell, it's having a problem finding the default constructor for the class for some reason.
This is the code for my InteractableActor.h:
And this is the class for InteractableActor.cpp:
This is the related piece of code I am running within my PlayerCharacter.cpp:
Any clues on how to fix this?
asked Aug 10 '15 at 02:25 AM in C++ Programming
Actors & Objects can't have pure virtual functions in them. The reason is that the UClass for those objects needs to create the CDO (class default object). This happens even for Abstract classes. It's pretty key to how the UObject property information is copied from parent classes to child classes. The best you can do to mimic pure virtual behavior is to assert in the abstract class implementation.
answered Aug 10 '15 at 09:22 PM
Here's the code I mean
answered Aug 21 '15 at 01:38 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here