iphone - Xcode 4 - clang 错误

标签 iphone ios objective-c xcode4.2

我正在从 Xcode 3.5 迁移到 Xcode 4 并且 当我尝试存档我的应​​用以进行临时分发时。
我收到这个错误

预编译 MyApp_Prefix.pch

ProcessPCH /Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/Build/PrecompiledHeaders/MyApp_Prefix-crxrbmeralwexyefvuwvzexquuin/MyApp_Prefix.pch.pth MyApp_Prefix.pch normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/return/Projects/iphone-MyApp
setenv LANG en_US.US-ASCII
setenv PATH "/Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin:/Xcode4.2/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -x objective-c-header -arch armv7 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -DFAVOURITES_ENABLED=0 -isysroot /Xcode4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=3.0 -iquote "/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/IntermediateBuildFilesPath/MyApp.build/Distribution-iphoneos/MyApp.build/MyApp-generated-files.hmap" "-I/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/IntermediateBuildFilesPath/MyApp.build/Distribution-iphoneos/MyApp.build/MyApp-own-target-headers.hmap" "-I/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/IntermediateBuildFilesPath/MyApp.build/Distribution-iphoneos/MyApp.build/MyApp-all-target-headers.hmap" -iquote "/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/IntermediateBuildFilesPath/MyApp.build/Distribution-iphoneos/MyApp.build/MyApp-project-headers.hmap" "-I/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/BuildProductsPath/Distribution-iphoneos/include" "-I”/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp" -I- "-IDistribution/BuildProductsPath/Distribution-iphoneos/../three20″" "-I“/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp" -I- "-IDistribution/BuildProductsPath/Distribution-iphoneos/../../three20″" -Ithree20/Build/Products/three20 -I/Xcode4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include/libxml2 "-I/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/IntermediateBuildFilesPath/MyApp.build/Distribution-iphoneos/MyApp.build/DerivedSources/armv7" "-I/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/IntermediateBuildFilesPath/MyApp.build/Distribution-iphoneos/MyApp.build/DerivedSources" "-F/Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/ArchiveIntermediates/MyApp - Distribution/BuildProductsPath/Distribution-iphoneos" -c /Users/return/Projects/iphone-MyApp/MyApp_Prefix.pch -o /Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/Build/PrecompiledHeaders/MyApp_Prefix-crxrbmeralwexyefvuwvzexquuin/MyApp_Prefix.pch.pth -MMD -MT dependencies -MF /Users/return/Library/Developer/Xcode/DerivedData/MyApp-cwtxjgdpsvtoyxcfpytllmzaxceb/Build/PrecompiledHeaders/MyApp_Prefix-crxrbmeralwexyefvuwvzexquuin/MyApp_Prefix.pch.d


**clang: error: '-I-' not supported, please use -iquote instead**
**Command /Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1**

你知道我应该怎么做才能解决这个问题吗?


更新(按照 MacMade 的建议报告结果)

所以在目标build设置中:
Other C flags 我什么都没有。
User Header Search Paths

中没有任何内容

标题搜索路径中,我有:

  • ”$(BUILT_PRODUCTS_DIR)/../three20″
  • “$(BUILT_PRODUCTS_DIR)/../../three20″
  • ./three20/Build/Products/three20
  • /usr/include/libxml2

但我不确定要在这里更改什么。

Compiler for C/C++/Objective-C 设置中, 我从 Apple LLVM compiler 切换 LLVM GCC 并收到此消息:

cc1obj: note: obsolete option -I- used, please use -iquote instead  
cc1obj: error: -I- specified twice  
cc1obj: note: obsolete option -I- used, please use -iquote instead 

UPDATE(按照MacMade的更新建议报告结果)

所以我移动:

  • ”$(BUILT_PRODUCTS_DIR)/../three20″
  • “$(BUILT_PRODUCTS_DIR)/../../three20″

用户 header 搜索路径

而且有效!!!
(注意:我没有移动 ./three20/Build/Products/three20 因为我看到了
can't find <Three20/Three20.h>
如果我这样做的话,在构建项目时会出错。)

最佳答案

显然,您已经为包含路径设置了自定义编译器标志。

转到目标的build设置并选中此选项:

  • 其他 cflags

如果里面有东西,你可以用-iquote代替它版本。

否则,仍然在build设置中,检查以下选项的值:

  • header 搜索路径
  • 用户 header 搜索路径

尝试操纵这些值(如果适用)。

否则,您也可以继续使用 GCC 作为前端,而不是 Clang。

您可以通过将 Compiler for C/C++/Objective-C build设置设置为 LLVM GCC 而不是 Apple LLVM compiler 来实现此目的.

编辑

根据您的编辑,我可以看出您正在使用 Three20 库。

根据您如何包含这些内容,您可能希望将这些搜索路径放入User Header Search Paths,而不是Header search paths(如果您包含它们使用 "" 而不是 <> )。
尝试为 Three20 执行此操作,但将 libxml 留在这里...

关于iphone - Xcode 4 - clang 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8301649/

相关文章:

iphone - iOS - 获取窗口中 View 的位置?

ios - 应该如何为单元测试设置 Swift + Objective-C 项目

objective-c - 究竟是什么将MoveToParentViewController : and didMoveToParentViewController: do?

ios - UITableViewCell 子类与 UIImageView 的正确重用方法

iphone - 从响应 NSString 中获取子字符串

iphone - 将文本/数据以及特殊字符作为参数添加到 iphone 中的 api(url)

iphone - 在 iOS 上使用与核心数据的关系

ios - 触发drawRect重绘 View 的按钮

ios - 带有 iOS 的 Google App Engine 上的 Facebook OAuth

ios - iPhone 模拟器 - 如何检测应用程序何时在模拟器上运行(因此可以设置测试数据)?