UE4.19 failes to compile pointer code even with includes

I appear to have a problem, after delving through these forums, I have included the needed header files into OpenDoor.cpp and it is still not compiling, this time with a different error message.

CompilerResultsLog: Error: D:\Users\jonat\git\Udemy\Unreal\files\Section_03\BuildingEscape\Source\BuildingEscape\OpenDoor.cpp(23) : error C3867: 'APlayerController::GetPawnOrSpectator': non-standard syntax; use '&' to create a pointer to member
CompilerResultsLog: Error: D:\Users\jonat\git\Udemy\Unreal\files\Section_03\BuildingEscape\Source\BuildingEscape\OpenDoor.cpp(23) : error C2440: '=': cannot convert from 'APawn *(__cdecl APlayerController::* )(void) const' to 'AActor *'
CompilerResultsLog: Error: D:\Users\jonat\git\Udemy\Unreal\files\Section_03\BuildingEscape\Source\BuildingEscape\OpenDoor.cpp(23) : note: There is no context in which this conversion is possible

I am fully aware that UE4.20 and 4.21 are out as of this post, but I started on this course with UE4.19 and I am aware a lot has changed since Ben uses UE4.9. Any thoughts? Solutions?

Here is a Gist link to both the CPP and Header files of the OpenDoor component. https://gist.github.com/Jonathing/56e603eff18334b38eee82e6a2711ef7

I’m not 100% sure. And you probably already fixed this but GetPawnOrSpectator is a function and so you’ll need to brackets on the end like this GetPawnOrSpectator().

Try that and see if you get any other errors after that.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms