Using #ifdef doesn't work with Unreal Header Tool

You don’t need the defined keyword. If it is not defined it is falsy.

You are doing the equivalent of this in the macro world:

if (I  < 5 || 10 || 17)

This is an illegal statement. The code you want is:

#if __cplusplus || UE_GAME || UE_EDITOR || UE_SERVER