Hi all,
almost every day I have to practically recompile Unreal when compiling my projects just because of an error like the one below:
fatal error: file ‘/usr/include/linux/sysctl.h’ has been modified since the precompiled header ‘/path/to/UnrealEngine/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/Core/CorePrivatePCH.h.gch’ was built note: please rebuild precompiled header ‘/path/to/UnrealEngine/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/Core/CorePrivatePCH.h.gch’
I’ve been doing some tests to reproduce the error and I found that the error is caused in clang++ instead of Unreal (you may know this already).
I saw that the error occurs if a do a single "touch /usr/include/linux/sysctl.h"
. Of course I don’t touch this file or change it. I don’t even know when this file gets updated in a computer that I never installed anything after compiling Unreal.
For me, I don’t even care when that file changes. I would like to completely ignore it once Unreal Engine is compiled.
Does any of you know whether is possible to do that in Unreal?
I know this may be more clang++ than Unreal related, but I’m asking here because you may have any idea.
Reproducing the error
In case you want to reproduce this error outside of Unreal, you can do the following:
# Create a file first.h:
echo "#define version 1" > first.h;
# Create a second.h file which includes first.h:
echo '#include "first.h"' > second.h;
# Create a main file which includes second.h:
echo -e '#include "second.h"\n int main(){return 0;}' > main.cpp
# Compile the second.h, generating a second.h.gch:
clang++ second.h
# Now let's "change" first.h:
touch first.h;
# If we just compile main.cpp, it works:
clang++ main.cpp
# If we compile main.cpp telling clang++ to use the precompiled header, then the error shows up:
clang++ main.cpp -include second.h
# Now the error is raised:
# fatal error: file '/path/to/first.h' has been modified since the precompiled header 'second.h.gch' was built
# note: please rebuild precompiled header 'second.h.gch'
# 1 error generated.