UHT wrongly complains about precompiled header include
I have a source file that I use in multiple projects, and it needs its first #include to be for its precompiled header. My problem is, the precompiled header is different for each of my projects. My solution to this is to add preprocessor directives to change the first #include depending on which project is compiling the file.
The way that the preprocessor directives are highlighted in Visual Studio shows me that they should be working as expected. However when I compile my VS solution for Project 2 it complains that my first #include is for the file "First_Project.h" which it can't find.
This is a bug in Unreal's build process, as it doesn't consider conditional preprocessor directives when trying to find the first #include in a file.
Looks like this has already been submitted as a bug report/feature request UE-20145
answered Jul 21 '16 at 09:06 PM
It's not compiler but UHT error most likely, it is known that it does ignores conditionals, i seen raport of that in the past
I can think you could work around it by creating header file of same name in both project and make proper include there.
Btw, if you start to use same code over same multiple projects, it means it's time to move it to a plugin where you can easily reuse that code with just one click of a button, that what plugins was made for
Follow this question
Once you sign in you will be able to subscribe for any updates here