Type alias not work

Hello, I have some trouble with type alias in unreal, and here is my code:

typdef APawn ATarget;

// do something


ATarget* GetTarget();

That not work. Compiler bring out a error “Unrecognized type ‘ATarget’ - type must be a UCLASS, USTRUCT or UENUM”

I tried using ATarget = APawn and even #define ATarget APawn, but code still not worked.

What’s wrong inside? How to use type alias correctly?


How to use type alias correctly?

You can’t. UHT doesn’t support them since it only does a minimal subset of C++ parsing (on the things tagged with our macros) and doesn’t parse or maintain a list of aliases.