ios Xcode 4.1 致命错误:自构建预编译头以来已修改 stdlib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7071523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:06:34  来源:igfitidea点击:

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

iosxcodecompiler-errors

提问by grfryling

Building an iPhone app, using:

构建一个 iPhone 应用程序,使用:

  • Xcode 4.1
  • Base SDK iOS 4.3
  • Apple LLVM Compiler 2.1
  • Xcode 4.1
  • 基础 SDK iOS 4.3
  • 苹果 LLVM 编译器 2.1

I have started getting the following error:

我开始收到以下错误:

fatal error: file '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h' has been modified since the precompiled header was built

致命错误:自构建预编译头文件以来,文件“/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h”已被修改

I have tried reinstalling Xcode and OS X - no luck. What's causing this?

我试过重新安装 Xcode 和 OS X - 没有运气。这是什么原因造成的?

回答by logancautrell

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

首先通过 Product -> Clean 菜单尝试干净的构建(从 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 OKto delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.

此目录包含项目的构建产品和索引。删除它是可以的,因为它只包含由 Xcode 生成的项目。Xcode 将在下次打开项目时重新生成所有内容。

回答by Darwin Smith II

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

我能够以更简单的方式修复它,只需从 Xcode 菜单栏中选择 Product > Clean,然后 Product > Build。

回答by Ants

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

存档时删除 DerivedData 文件夹对我不起作用。

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

回答by charles

I thought I would add a separate answer rather than a comment to Cryptognome's answer, because it is in fact a different solution when the issue comes from running xcodebuild. Like Cryptognome, I had the error come up with the command-line tool xcodebuild. As an alternative to manually going into the /varsubfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variable SHARED_PRECOMPS_DIR, e.g as follows

我想我会添加一个单独的答案而不是对 Cryptognome 的答案的评论,因为当问题来自运行时,它实际上是一个不同的解决方案xcodebuild。像 Cryptognome 一样,我在命令行工具中出现了错误xcodebuild。作为手动进入/var子文件夹的替代方法,我发现我可以为共享 PCH 设置自己的缓存,您可以通过设置环境变量来实现 SHARED_PRECOMPS_DIR,例如如下

xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH

This way, I never get the error in automatic builds.

这样,我永远不会在自动构建中遇到错误。

Note in the above command, I would also typically set the OBJROOTand SYMROOTenv var to build also in /tmp. At the end, I clean things up.

请注意,在上面的命令中,我通常还会将OBJROOTSYMROOTenv var设置为也在 /tmp 中构建。最后,我把东西清理干净。

回答by David Gish

The xcodebuild command line tool sometimes fails with this error. This happened to me when I synched an svn workspace to an earlier build. The xcodebuild tool keeps its precompiled headers in the folder Ants mentioned:

xcodebuild 命令行工具有时会因此错误而失败。当我将 svn 工作区同步到早期版本时,这发生在我身上。xcodebuild 工具将其预编译头文件保存在提到的 Ants 文件夹中:

/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/

You have to look in the build command itself to see the actual folder name (-include /var/...), but it may be using several if you're building for different architectures (arm6, arm7, simulator, e.g.) So if you're having this problem with a command line build, just delete everything in /var/.../SharedPrecompiledHeaders.

您必须查看构建命令本身以查看实际文件夹名称(-include /var/...),但如果您为不同的体系结构(例如 arm6、arm7、模拟器)构建,它可能会使用多个如果您在命令行构建中遇到此问题,只需删除 /var/.../SharedPrecompiledHeaders 中的所有内容。

回答by Durai Amuthan.H

Solution:

解决方案:

1)Product->Clean

1)产品->清洁

2)Product->Build

2)产品->构建

Error Type:

错误类型:

a kind of Build error

一种构建错误

One of the causes:

原因之一:

one might have changed the framework file. This sometimes happens when a change is made to a framework that another framework depends upon. The precompiled header cache gets out of sync, and Xcode is unable to compile the given project.

一个人可能已经改变了框架文件。当对另一个框架所依赖的框架进行更改时,有时会发生这种情况。预编译头缓存不同步,Xcode 无法编译给定项目。

One of the Scenarios:

场景之一:

one might have chosen Jump To Definition and did some change after selecting a framework control.

人们可能选择了跳转到定义并在选择框架控件后进行了一些更改。

回答by Sanjeev

Remove the contents for the Simulator by iOS Simulator > Reset Content and Settings... and hit Rest. This will remove any existing pre-compiled instances of the headers and resources. This worked for me

通过 iOS Simulator > Reset Content and Settings... 删除 Simulator 的内容,然后点击 Rest。这将删除头文件和资源的任何现有预编译实例。这对我有用

回答by Noah Dyer

I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.

我可以通过清理(command+shift+K)和重建来摆脱这个错误。

回答by Narasimha Nallamsetty

I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..

我首先尝试过但没有用。最后我删除了Xcode并重新安装。现在它工作正常..

Xcode->delete->install again

Xcode->删除->再次安装

It might help some one...

它可能会帮助某人...

回答by Crystian

I had this error on cordova when I ran : cordova run ios

我在运行时在cordova上遇到了这个错误: cordova run ios

fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
  '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
  '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.

** BUILD FAILED **    

The following build commands failed:
    CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler

I tried with clean and build but doesn't work, finaly I removed the folder '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode' and works! This tip, may be help others

我尝试使用干净和构建但不起作用,最后我删除了文件夹“/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode”并工作!这个提示,可能对其他人有帮助