Xcode 4.5.2 fatal error: Precompiled header has be

2019-09-05 01:36发布

问题:

I've been making changes to my project all day, building and running the project, and now suddenly when trying to build I am now getting this error:

fatal error: file
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h'
has been modified since the precompiled header was built
  • When I attempt to clean the project by going to Product -> Clean it refuses to clean and gives me the same error.
  • I've removed the .build directory from within the project folder, forcing it to rebuild the project and that hasn't fixed anything.
  • I've removed the ~/Library/Developer/Xcode/DerivedData/PROJECT_NAME_HERE folder, also did not help.
  • I've tried closing and reopening Xcode, which also did not help.

I checked the Foundation.h header file and it shows a Date Modified of Oct. 30th, along with every other file in the Headers folder, so it hasn't actually been modified.

Other projects that I build do not have this error.

I'm at a loss here. Seems like Xcode is lying to me.

回答1:

Well, I didn't find a clean solution to this problem, but it was a solution nevertheless. The project was under source control, so I submitted my changes to the repository, nuked the entire project off my hard drive, and fetched it back from the repository and that fixed the problem.

My guess is there was somehow a setting in the project or data stored along side the project that is not ever submitted to the repository, which is why deleting and refreshing the project from the repository fixed the issue. What's odd is that deleting DerivedData and the .build directory from within the project didn't fix the issue, so it would have to be a setting stored elsewhere.



标签: c++ xcode