Xcode 4.1 fatal error: stdlib modified since the precompiled header was built

Solution 1:

First try a clean build via the Product -> Clean menu (as of XCode 4.6.2).

If that still doesn't work then open the Organizer (from the menu select Window->Organizer). Once the Organizer is open, select Projects from the toolbar at the top of the window. On the left is a list of projects, select the one you are having a problem with.

The details panel (to the right of the list) will display the project name, location, status. The row beneath that shows where the Derived Data is located. Click the Delete... button the far right. A dialog will appear, click Delete.

You can also manually delete the Derived Data:

~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}

This directory contains built products and indexes for the project. It is OK to delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.

Solution 2:

I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.

Solution 3:

Deleting the DerivedData folder did not work for me when Archiving.

I had to look at Build Settings - Build Locations - Precompiled Header Cache Path and delete that folder.

For me that was:

/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders