ios Xcode 4 - 叮当声错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8301649/
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 15:39:11  来源:igfitidea点击:

Xcode 4 - clang error

iphoneiosobjective-cxcode4.2

提问by Tuyen Nguyen

I'm migrating from Xcode 3.5 to Xcode 4 and while I'm trying to Archiving my app for AdHoc distribution.
I received this error

我正在从 Xcode 3.5 迁移到 Xcode 4,同时我正在尝试为 AdHoc 分发存档我的应​​用程序。
我收到这个错误

Precompile MyApp_Prefix.pch

预编译 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**

Do you know what I should do to fix this?

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



UPDATE (report result after followed MacMade's suggestions)

更新(遵循 MacMade 的建议后的报告结果)

So in the Target Build Settings:
I have nothing in Other C flags.
I have nothing in User Header Search Paths

所以在目标构建设置中
我在其他 C 标志中没有任何内容。
我在用户标题搜索路径中没有任何内容

In Header Search Paths, I have:

Header Search Paths 中,我有:

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

but I'm not sure what to change here.

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

In Compiler for C/C++/Objective-Csetting, I switched from Apple LLVM compilerto LLVM GCCand get this message:

Compiler for C/C++/Objective-C设置中,我从Apple LLVM compilerto切换到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 (report result after followed MacMade's updated suggestions)

更新(遵循 MacMade 的更新建议后的报告结果)

So I move:

所以我动了:

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

to User Header Search Paths

用户标题搜索路径

and it works!!!
(NOTE: I don't move ./three20/Build/Products/three20because I see
can't find <Three20/Three20.h>
errors while building the project if I do.)

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

采纳答案by Macmade

Apparently, you've set custom compiler flags for the include paths.

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

Go to your target's build settings and check this option:

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

  • Other C flags
  • 其他 C 标志

If you have something in it, you may replace it by the -iquoteversion.

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

Otherwise, still in the build settings, check the value of the following options:

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

  • Header Search Paths
  • User Header Search Paths
  • 标题搜索路径
  • 用户标题搜索路径

Try to manipulate these values, if applicable.

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

Otherwise, you may also continue to use GCC as a fronted, instead of Clang.

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

You can do this by setting the Compiler for C/C++/Objective-Cbuild setting to LLVM GCCinstead of Apple LLVM compiler.

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

EDIT

编辑

Based on your edit, I can see you are using the Three20 library.

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

Depending on how you include that stuff, you may want to put these search paths to the User Header Search Paths, instead of Header search paths(if you include them with ""instead of <>).
Try to do this for Three20, but leave libxml here...

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

回答by kordiseps

I tried these solutions. But i couldn't or not working for me.
I solved this problem with this way:

I deleted MuseumTestsin targets
When you clicked your project in general tab on left there is targets

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

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

xcode project general general tab

xcode 项目常规选项卡

回答by Deepak

You can solve this problem by selecting Generaltab of AppNameTestsand select your app from the drop down list and enable "Allow testing Host Applications APIs"

您可以通过选择AppNameTests 的General选项卡并从下拉列表中选择您的应用程序并启用“ Allow testing Host Applications APIs”来解决此问题

回答by Yigit Yuksel

This error also caused by wrong header import.

此错误也是由错误的标头导入引起的。

For example your class is "yourclass.h", but in wrong way if you import "yourclass.m" it is cause this error.

例如,您的班级是“yourclass.h”,但如果您导入“yourclass.m”,则以错误的方式导致此错误。

回答by Cristi B?lu??

I just had this problem with an instagram lib, my mistake was that i was importing the files to a target and compiled the other target. It gave me some headaches.

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

回答by Kris Basque

Hi guys we did something that worked... We had the same problem and it was quite easy to solve... First you go to terminal type cd cd (drag the whole folder where your file is in) and press return

嗨,伙计们,我们做了一些有效的事情......我们遇到了同样的问题并且很容易解决......首先你去终端类型 cd cd (拖动你的文件所在的整个文件夹)然后按回车

after you are inside the folder you have to write:

进入文件夹后,您必须编写:

pod instal and type return

pod 安装和类型返回

something like that....

类似的东西....

Last login: Wed Aug 21 09:19:29 on console

上次登录: 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 Analyzing dependencies

WozMac1:~ KrisBasque$ WozMac1:~ KrisBasque$ WozMac1:~ KrisBasque$ WozMac1:~ KrisBasque$ cd WozMac1:~ KrisBasque$ cd /Users/KrisBasque/Documents/QUADDRO/medapp WozMac1:medapp KrisBasquely$ 安装依赖

CocoaPods 0.23.0 is available.

CocoaPods 0.23.0 可用。

Downloading dependencies Using AFNetworking (1.3.1) Installing FMDB (2.1) Using MBProgressHUD (0.7) Using PSStackedView (1.0) Using Reachability (3.1.1) Installing SDWebImage (3.3) Using TapkuLibrary (0.2.4) Installing libwebp (0.3.0-rc7) Generating Pods project Integrating client project WozMac1:medapp KrisBasque$

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

回答by Jayden Kelly

The way I solved this was my making sure no other implementation files we're linked to your file. Linking interface files is fine though

我解决这个问题的方法是确保没有其他实现文件与您的文件相关联。虽然链接接口文件很好