New error in 4.8 -- C2512: no appropriate default constructor available
I have a class derived from AActor and it contains a member that does not have a default constructor, i.e.:
But I initialize "x" accordingly in the CPP file:
This worked as it should in 4.7 but in 4.8 I'm getting this error:
The problem line in the generated code is this:
I am sorry to hear about your problem. Please note that in 4.8 the way virtual pointers are obtained for UClasses was changed, so that special empty constructor is used to get it. Special virtual table helper constructor is generated automatically for most cases, but sometimes it's not possible (for example when there is no default constructor for members types). In this situation, there is a possibility to override the generated constructor and write a custom one like this:
(Constructor of the base class needs to be called with the same parameter.)
Please note that this constructor should not be used for anything else since there is no guarantee the object will be in correct state after calling it.
Thus, to fix the problem, you can add something like this to your code:
Hope this helped!
Follow this question
Once you sign in you will be able to subscribe for any updates here