SharedPCH.Engine.h.pch not found

Hey,

I wanted to add a simple C++ class to my blueprint based project, but when it auto compiled in the editor it threw an error and told me to rebuild the module. If I try to build manually from source I’m getting the following error: “SharedPCH.Engine.h.pch”: No such file or directory

What I tried:

  • Set the PCHUsage to no pch and even specified my own header file for this purpose, but then it’s just giving the same error with a different filename.
  • I cannot disable header precompiling in VS since there is no freakin option in the configuration settings.
  • I deleted the Intermediate and Saved folder and I also made sure to clean the project and rebuild (also with admin privileges)

I’m on VS 2019 and set the accessor in the config to exactly that. I do have installed the UE4 installer integration, C++ game dev tools and the windows 10 SDK.

Thanks in advance.

Okay, I found the answer, I just don’t know why.

I moved my project directory outside of my OneDrive folder into my documents folder (Unreal Projects). Could a long path length be causing such an issue?

Well no, I’m not really able to use git as I’m developing from different devices and my project already’s got a size of more than 20GB. Uploading that to git is not really funny.

Second, I did put that expression into my build file and I also rebuilt my project. But it did not generate the precompiled header.

first you should use git for keeping track of changes in your project not onedrive.

second you must put PCHUsageMode.UseExplicitOrSharedPCH into your module’s .build.cs file inside your project.

once you do this, rebuild your project and your PCH header will be located in:

PROJECT LOCATION DIRECTORY\Intermediate\Build\Win64\Your Project Name\Development\Engine

that’s is if you want to make use of this precompiled header to boost intellisense speed follow these steps:

right click on your project then properties then NMake and under Intellisense section input following into last input box:

/Yu SharedPCH.Engine.h.pch

If you need additional information let me know!

Most likely if you use buildconfiguration.xml it is not set to generate precompiled header, or it could be that your project does not comply with IWYU:

Even if that would be the case, that doesn’t explain why it worked when I moved the project folder into another…

I also solved the error by moving the proyect to another route, in my case I think it was because in the route it appears my name, which contains a non-ASCII character. So I think if you have an non ASCII character the compiler can’t find the file.

Thank you for givig the idea to change the route

1 Like