【问题标题】:Xcode 4 - clang errorXcode 4 - 铿锵声错误
【发布时间】:2012-01-08 06:06:58
【问题描述】:

我正在从 Xcode 3.5 迁移到 Xcode 4 并且 当我尝试归档我的应用程序以进行 AdHoc 分发时。
我收到了这个错误

预编译 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 的建议报告结果)

所以在Target Build Settings中:
我在其他 C 标志中没有任何内容。
我在 用户标题搜索路径

中没有任何内容

标题搜索路径中,我有:

  • ”$(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 

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

所以我搬家了:

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

用户标题搜索路径

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

【问题讨论】:

  • 我也有这个问题,发现XCode很挑剔。只有当我完全遵循 Tuyen Nguyen 所做的事情时,它才会起作用 - 将以 $(BUILT_PRODUCTS_DIR) 开头的路径移动到用户标题搜索路径,并将其他路径留在原处。
  • 当我将标头搜索路径与其他 C 标志混淆时遇到问题...aarrg!
  • 在我的GCC_PREPROCESSOR_DEFINITIONS 的情况下,我有"'$(inherited)'" 的问题是当继承变量为空时使用单引号

标签: iphone ios objective-c xcode4.2


【解决方案1】:

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

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

  • 其他 C 标志

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

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

  • 标题搜索路径
  • 用户标头搜索路径

如果适用,请尝试操纵这些值。

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

您可以通过将 Compiler for C/C++/Objective-C 构建设置设置为 LLVM GCC 而不是 Apple LLVM 编译器 来做到这一点.

编辑

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

根据您包含这些内容的方式,您可能希望将这些搜索路径放入 用户标题搜索路径,而不是 标题搜索路径(如果包含它们用"" 代替<>)。
尝试为 Three20 执行此操作,但将 libxml 保留在此处...

【讨论】:

  • 对我来说,有人将 SrcRoot 放在了标题搜索路径中。删除有效。奇怪的是它建立在一台机器上而不是另一台机器上。
【解决方案2】:

我尝试了这些解决方案。但我不能或不能为我工作。
我用这种方式解决了这个问题:

我删除了目标中的 MuseumTests
当您在左侧的常规选项卡中单击您的项目时,会出现目标

【讨论】:

    【解决方案3】:

    您可以通过选择 AppNameTestsGeneral 选项卡并从下拉列表中选择您的应用并启用“允许测试主机应用程序 API 来解决此问题强>”

    【讨论】:

      【解决方案4】:

      我刚刚遇到了一个 instagram lib 的问题,我的错误是我将文件导入到一个目标并编译了另一个目标。这让我有些头疼。

      【讨论】:

        【解决方案5】:

        大家好,我们做了一些有效的事情...... 我们有同样的问题,而且很容易解决...... 首先你去终端类型 cd cd(拖动文件所在的整个文件夹)并按回车键

        进入文件夹后,你必须写:

        pod 安装和类型返回

        类似的东西....

        上次登录时间:8 月 21 日星期三 09:19:29 在控制台上

        WozMac1:~ KrisBasque$ WozMac1:~ KrisBasque$ WozMac1:~ KrisBasque$ WozMac1:~ KrisBasque$ cd WozMac1:~ KrisBasque$ cd /Users/KrisBasque/Documents/QUADDRO/medapp WozMac1:medapp KrisBasque$ pod install 分析依赖关系

        CocoaPods 0.23.0 可用。

        下载依赖 使用 AFNetworking (1.3.1) 安装 FMDB (2.1) 使用 MBProgressHUD (0.7) 使用 PSStackedView (1.0) 使用可达性 (3.1.1) 安装 SDWebImage (3.3) 使用 TapkuLibrary (0.2.4) 安装 libwebp (0.3.0-rc7) 生成 Pods 项目 整合客户项目 WozMac1:medapp KrisBasque$

        【讨论】:

          【解决方案6】:

          我解决这个问题的方法是确保没有其他实现文件链接到您的文件。不过链接接口文件没问题

          【讨论】:

            【解决方案7】:

            这个错误也是由于头文件导入错误造成的。

            例如你的班级是“yourclass.h”,但是如果你以错误的方式导入“yourclass.m”,就会导致这个错误。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2016-10-24
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多