Xcode 4.1 致命错误:自构建预编译头以来 stdlib 已修改
构建 iPhone 应用程序,使用:
- Xcode 4.1
- Base SDK iOS 4.3
- Apple LLVM Compiler 2.1
我开始收到以下错误:
致命错误:文件 '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h' 自构建预编译头以来已被修改
我尝试重新安装 Xcode 和 OS X - 没有运气。这是什么原因造成的?
Building an iPhone app, using:
- Xcode 4.1
- Base SDK iOS 4.3
- Apple LLVM Compiler 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
I have tried reinstalling Xcode and OS X - no luck. What's causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
首先通过 Product -> 尝试干净的构建干净的菜单(从 XCode 4.6.2 开始)。
如果仍然不起作用,则打开管理器(从菜单中选择“窗口”->“管理器”)。打开管理器后,从窗口顶部的工具栏中选择“项目”。左侧是项目列表,选择您遇到问题的项目。
详细信息面板(列表右侧)将显示项目名称、位置、状态。下面的行显示派生数据所在的位置。单击最右侧的删除...按钮。将出现一个对话框,单击“删除”。
您还可以手动删除派生数据:
该目录包含项目的构建产品和索引。删除它是可以的,因为它只包含 Xcode 生成的项目。下次打开项目时,Xcode 将重新生成所有内容。
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:
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.
我能够以更简单的方式修复它,只需选择“产品”>“清洁,然后产品>从 Xcode 菜单栏构建。
I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.
存档时删除 DerivedData 文件夹对我不起作用。
我必须查看“构建设置”-“构建位置”-“预编译标头缓存路径”并删除该文件夹。
对我来说就是:
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:
我想我应该添加一个单独的答案,而不是对 Cryptognome 的答案进行评论,因为当问题来自运行 xcodebuild 时,它实际上是一个不同的解决方案。与 Cryptognome 一样,我在使用命令行工具
xcodebuild
时也遇到了错误。作为手动进入/var
子文件夹的替代方法,我发现可以为共享 PCH 设置自己的缓存,您可以通过设置环境变量SHARED_PRECOMPS_DIR
来实现这一点,例如如下这样,我在自动构建中永远不会遇到错误。
请注意,在上面的命令中,我通常还会设置 OBJROOT 和 SYMROOT 环境变量以在 /tmp 中构建。最后,我把东西清理干净。
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 toolxcodebuild
. As an alternative to manually going into the/var
subfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variableSHARED_PRECOMPS_DIR
, e.g as followsThis way, I never get the error in automatic builds.
Note in the above command, I would also typically set the
OBJROOT
andSYMROOT
env var to build also in /tmp. At the end, I clean things up.xcodebuild 命令行工具有时会失败并出现此错误。当我将 svn 工作区同步到早期版本时,就发生了这种情况。 xcodebuild 工具将其预编译标头保留在 Ants 提到的文件夹中:
您必须查看构建命令本身以查看实际的文件夹名称(-include /var/...),但如果您正在构建,它可能会使用多个文件夹名称对于不同的体系结构(arm6、arm7、模拟器等)因此,如果您在命令行构建时遇到此问题,只需删除 /var/.../SharedPrecompiledHeaders 中的所有内容即可。
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:
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.
通过 iOS Simulator > 删除模拟器的内容重置内容和设置...然后点击休息。这将删除标头和资源的任何现有预编译实例。这对我有用
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
解决方案:
1)Product->Clean
2)Product->Build
Error 类型:
一种 Build error
原因之一:
可能更改了框架文件。
当对另一个框架所依赖的框架进行更改时,有时会发生这种情况。预编译头缓存不同步,Xcode 无法编译给定项目。
场景之一:
人们可能选择了“跳转到定义”,并在选择框架控件后做了一些更改。
Solution:
1)Product->Clean
2)Product->Build
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.
One of the Scenarios:
one might have chosen Jump To Definition and did some change after selecting a framework control.
我只需通过清理(command+shift+K)和重建就可以摆脱这个错误。
I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.
我首先尝试过但没有用。最后我删除了Xcode并重新安装了。现在它工作正常..
Xcode->删除->再次安装
它可能会对某些人有所帮助...
I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..
Xcode->delete->install again
It might help some one...
当我运行时,我在cordova上遇到了这个错误:
cordova run ios
我尝试使用 clean 和 build 但不起作用,最后我删除了文件夹 '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com .apple.DeveloperTools/6.0-6A313/Xcode' 并且可以工作!
这个提示可能对其他人有帮助
I had this error on cordova when I ran :
cordova run ios
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
Clean
方法对我来说不起作用,最终我通过重新安装 XCode 解决了这个问题。Clean
ways are not working for me, eventually I solved this issue by reinstall XCode.