# Project cannot compile during packaging - No such file or directory - but can run game and build from VS2022

**URL:** <https://forums.unrealengine.com/t/project-cannot-compile-during-packaging-no-such-file-or-directory-but-can-run-game-and-build-from-vs2022/1136290>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [April 21, 2023, 10:49pm UTC](https://forums.unrealengine.com/t/project-cannot-compile-during-packaging-no-such-file-or-directory-but-can-run-game-and-build-from-vs2022/1136290 "2023-04-21T22:49:09Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [April 22, 2023, 7:59pm UTC](https://forums.unrealengine.com/t/project-cannot-compile-during-packaging-no-such-file-or-directory-but-can-run-game-and-build-from-vs2022/1136290/10 "2023-04-22T19:59:43Z")

</div>

Like I mentioned #Ifdef does not work on header includes … use #if

Another post on the forum touches on the subject

> [@Using #ifdef doesn't work with Unreal Header Tool](https://forums.unrealengine.com/t/using-ifdef-doesnt-work-with-unreal-header-tool/366377/4):
>
> 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

---

_[View the full topic](https://forums.unrealengine.com/t/project-cannot-compile-during-packaging-no-such-file-or-directory-but-can-run-game-and-build-from-vs2022/1136290)._
