# "# include" (with a space) is ignored for dependency parsing in UHT

**URL:** <https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362>\
**Category:** C++\
**Tags:** uht, unreal-engine, CPP, question\
**Created:** [September 13, 2016, 10:39pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362 "2016-09-13T22:39:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_6034b9e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6034b9e0](https://forums.unrealengine.com/u/anonymous_user_6034b9e0)\
**Post date:** [September 13, 2016, 10:39pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/1 "2016-09-13T22:39:49Z")

</div>

When you have a space after the pound sign for an include (or any other preprocessor directive), the statement is silently ignored by UHT when scanning for dependencies, even though this is perfectly valid preprocessor syntax.

This is problematic because it can cause UHT to not pick up dependencies for a file when generating the header metadata.

Specifically, `FHeaderParser::SimplifiedClassParse` needs to be updated to support whitespace after `#`

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [September 14, 2016, 6:48pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/2 "2016-09-14T18:48:23Z")

</div>

Hi Joergen,

Would it be possible to get an example where this is failing for you? I tried a simple setup using `# include` instead of `#include`, and didn’t run into any problems.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6034b9e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6034b9e0](https://forums.unrealengine.com/u/anonymous_user_6034b9e0)\
**Post date:** [September 14, 2016, 7:04pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/3 "2016-09-14T19:04:29Z")

</div>

Foo.h:

```
#pragma once

#include "Foo.generated.h"

USTRUCT()
struct FFoo {
    UPROPERTY()
    bool bReproduces;
};

```

Bar.h:

```
# include "Foo.h"
#include "Bar.generated.h"

USTRUCT()
struct FBar {
  UPROPERTY()
  TArray<FFoo> Foos;
};

```

It might depend on the arbitrary order that Foo.h and Bar.h are processed in, so if it doesn’t repro, try moving the structs around?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [September 22, 2016, 9:22pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/4 "2016-09-22T21:22:34Z")

</div>

Hi Joergen,

I had a to dig into this issue again today, and I think I may have reproduced it. When you see this happening, did you see the following error in the build output in Visual Studio?

```
Unrecognized type 'FBar' - type must be a UCLASS, USTRUCT or UENUM

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6034b9e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6034b9e0](https://forums.unrealengine.com/u/anonymous_user_6034b9e0)\
**Post date:** [September 22, 2016, 9:51pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/5 "2016-09-22T21:51:31Z")

</div>

Yes, that is what it errored out with

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [September 23, 2016, 7:28pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/6 "2016-09-23T19:28:34Z")

</div>

It does appear to have something to do with the order in which the structs/header files are compiled. I am trying to narrow it down now.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6034b9e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6034b9e0](https://forums.unrealengine.com/u/anonymous_user_6034b9e0)\
**Post date:** [September 23, 2016, 8:26pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/7 "2016-09-23T20:26:21Z")

</div>

I believe it’s because `FHeaderParser::SimplifiedClassParse` is not parsing the #include properly, which is causing it to not add that header as a dependency, so the order isn’t right.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [September 23, 2016, 8:40pm UTC](https://forums.unrealengine.com/t/include-with-a-space-is-ignored-for-dependency-parsing-in-uht/370362/8 "2016-09-23T20:40:53Z")

</div>

Hi Joergen,

The only way that I was able to get this to reproduce consistently was by adding a struct to a header file, then adding a second struct to a second header file that referenced the first struct. Once that was built, I had to essentially switch the structs so that the first one was now referencing the second one, and add a space in the include that I added to the first header file. It was a somewhat complicated repro, so if you are aware of a simpler method of reproducing the issue, that would be helpful.

I have entered ticket [UE-36390](https://issues.unrealengine.com/issue/UE-36390) to have this investigated further.
