This isn’t exactly following the video, but I wanted to try to use a template function to do the “find and assign” operations which are already repetitive with 2 components.
Following the example here:
https://wiki.unrealengine.com/Templates_in_C%2B%2B
…I defined the function inline in my .h file. But I haven’t been able to get any variation of it to compile.
Anyone who understands template functions in C++/Unreal can take a look and let me know how to fix?
OS: OSX 10.13.3
XCode: 9.3
Unreal: 4.19.1
This is my Grabber.h file that contains the template function:
This is the log of errors I see:
EXPECTATION
To compile this function and then be able to call it from Grabber.cpp to FindAndAssign PhysicsHandle and Input components
OBSERVED
Template function fails to compile with errors in gist above
WHAT I’VE TRIED
- put the template function in .h or .cpp files
- completely stub out the template function, leaving just the signature w empty body
- add/remove ‘static’ and ‘FORCEINLINE’ in all combinations
- compile a minimal template function, e.g. template FORCEINLINE void Foo(T p) {}