Can UnreadHeaderTool handle #ifdef?

I tried to include a header conditionally, but I am getting the following error:

“In MyActor: Unmatched ‘#endif’ in class or global scope”

Here is the relevant part of the header I am using #ifdef in:

#pragma once

#ifdef MYDEFINITION
#include "Foo.h"
#endif

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class AMyActor : public AActor

The header inside ifdef/endif isn’t important - I get the same error even when there’s nothing between ifdef and endif.

Is there a way around this problem?

It seems that #ifdef (and #ifndef) aren’t currently supported, however we have a pull request which should fix that: https://github.com/EpicGames/UnrealEngine/pull/67

Could you try using the following instead:

#if defined MYDEFINITION

#if defined” does get handled correctly. I always used the #ifdef shorthand, so I forgot that the longer version even existed. Thank you.

Hi, support for #ifdef and #ifndef was integrated in this commit:

https://github.com/EpicGames/UnrealEngine/commit/41834919f68cea583a400437e13a68b81f04015f

Steve

Thanks for the fix and for letting me know.