简体   繁体   English

命令 /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 失败,退出代码为 1

[英]Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I'm trying to do an application reading pdf using pdf kit in Xcode 4.3 but it gives me the following error我正在尝试使用 Xcode 4.3 中的 pdf 工具包读取 pdf 的应用程序,但它给了我以下错误

ld: duplicate symbol _OBJC_METACLASS_$_OverlayManager in /Users/dt4it/Library/Developer/Xcode/DerivedData/MyPdf4-bmkjglhhvneluqcbwpceiqjvdcmq/Build/Intermediates/MyPdf4.build/Debug-iphonesimulator/MyPdf4.build/Objects-normal/i386/OverlayManager-D0866CFD31A05E68.o and /Users/dt4it/Library/Developer/Xcode/DerivedData/MyPdf4-bmkjglhhvneluqcbwpceiqjvdcmq/Build/Intermediates/MyPdf4.build/Debug-iphonesimulator/MyPdf4.build/Objects-normal/i386/OverlayManager-B31AE7412100AF6D.o for architecture i386
Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

any help please ??有什么帮助吗??

Project Settings > Under "Targets", select your project > Build Phases > open "Compile Sources" and "Copy Bundle Resources".项目设置 > 在“目标”下,选择您的项目 > 构建阶段 > 打开“编译源”和“复制捆绑资源”。 Check if any files are listed in red color.检查是否有任何文件以红色列出。 If so , just delete it.如果是这样,只需将其删除。 Then clean and run.然后清理并运行。

Worked for me.为我工作。

Do a clean.干干净净。 product > clean . product > clean Terminal purge & reboot didn't work for me, cleaning did.终端清除和重新启动对我不起作用,清洁起作用了。

I had this same error and nobody seems to have an answer on StackOverflow that actually works.我有同样的错误,似乎没有人在 StackOverflow 上有实际工作的答案。 My problem was when I tried copying a project that was in a team repository.我的问题是当我尝试复制团队存储库中的项目时。 Turns out, in the ignore file, all files with the extension of *.pch were ignored from repository commits.结果是,在忽略文件中,所有扩展名为*.pch都从存储库提交中被忽略了。 This means that when I went to pull the project from the repo, the .pch file was missing, thus throwing this error.这意味着当我从 repo 中提取项目时, .pch文件丢失了,从而.pch这个错误。

Fortunately I had a copy of the project still and was able to just copy the .pch file over and I was then able to compile just fine.幸运的是,我仍然拥有该项目的副本,并且能够将.pch文件复制过来,然后我就可以很好地编译了。

Hope this helps?希望这可以帮助?

转到目标首选项,摘要选项卡,找到“部署目标”并增加它。

deleting ~/Library/Developer/Xcode/DerivedData helped me.删除~/Library/Developer/Xcode/DerivedData对我有帮助。

reference : link参考: 链接

I face this problem too.我也面临这个问题。 And ofc I looked for help in SO instead of use the common sense and check the error message.而且我在 SO 中寻求帮助而不是使用常识并检查错误消息。

The last part of the error message was the same as you.错误消息的最后一部分与您相同。

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 11

But few lines above I found:但我发现上面几行:

In file included from /Users/Ricardo/Documents/XCode/RealEstate-Finder-v1.2/RealEstateFinder/RealEstateFinder/RealEstateFinder-Prefix.pch:26:
/Users/Ricardo/Documents/XCode/RealEstate-Finder-v1.2/RealEstateFinder/RealEstateFinder/Config/Config.h:174:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
http://www.myserver.com/apps/mobile/rest.php?id=12

Which points to my Config.h file.它指向我的 Config.h 文件。

Happy coding!快乐编码!

You have accidentally included the .m file OverlayManager instead of the .h file inside the actual OverlayManager class itself!您不小心在实际的 OverlayManager 类中包含了 .m 文件 OverlayManager 而不是 .h 文件! Basically, he compiler already knows to compile the .m file, but when you #import it, the compiler tries to include it inline with that same source file, thus generating duplicate symbols.基本上,他的编译器已经知道要编译 .m 文件,但是当您 #import 它时,编译器会尝试将它包含在同一个源文件中,从而生成重复的符号。 But your case is unique, seeing as you are #importing the .m of the actual class' .m file!但是您的情况是独一无二的,因为您正在#importing 实际类的 .m 文件 .m ! It's recursively compiling your OverlayManager class.它递归地编译您的 OverlayManager 类。

The same thing happened to me and i found that i forgot to put the " at the end of the同样的事情发生在我身上,我发现我忘了把“放在”的末尾

#import "CPDConstants.h

so instead所以与其

#import "CPDConstants.h"

For me this error appears after cloning the project from a repository.对我来说,从存储库克隆项目后会出现此错误。 Someone removed a white space from the projects name (renamed: "The Project" to "TheProject") which caused some Build Settings errors to unvalid paths.有人从项目名称中删除了一个空格(重命名为:“The Project”到“TheProject”),这会导致一些Build Settings错误指向无效路径。

Sometimes reading the whole error logs is not a bad idea....有时阅读整个错误日志并不是一个坏主意......

Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list).试试这个 - 在 Xcode 左侧的文件/文件夹列表中点击你的项目名称(在列表的最顶部)。 Look at the "Targets" section on the left-hand side of the window to the right.查看右侧窗口左侧的“目标”部分。 Likely, there's two listed with the second being a "test" item.可能列出了两个,第二个是“测试”项目。 Right-click on that item and select "delete".右键单击该项目并选择“删除”。 Then try to run the project again.然后尝试再次运行该项目。

This problem usually occurs when there are more than two versions of XCode are installed in which different Swift versions incorporated for Ex.当安装了两个以上的 XCode 版本时,通常会出现此问题,其中为 Ex 合并了不同的 Swift 版本。 XCode 6.4 and XCode 7.3 are installed which are running Swift 1.2 and Swift 2.0.安装了运行 Swift 1.2 和 Swift 2.0 的 XCode 6.4 和 XCode 7.3。 By mistake you tries to compile code with icorrect version for Ex.您错误地尝试使用不正确的 Ex 版本编译代码。 your project in in Swift 1.2 and you tries to compile it with xcode 7.3.你的项目在 Swift 1.2 中,你试图用 xcode 7.3 编译它。 In this case drive data stores information for swift version but when you tries to compile code with correct XCode it gives error.在这种情况下,驱动器数据存储 swift 版本的信息,但是当您尝试使用正确的 XCode 编译代码时,它会出错。 To resolve this为了解决这个

  1. Delete drive Data删除驱动器数据
    a.一种。 In Xcode select preferences在 Xcode 中选择首选项

在此处输入图片说明

  1. Once preferences are open click on Location tab and click on the arrow in front of the 'Drived data' path.打开首选项后,单击位置选项卡,然后单击“驱动数据”路径前面的箭头。 It will open drived data folder它将打开驱动数据文件夹

在此处输入图片说明

  1. Quit Xcode退出 Xcode
  2. Delete all drive data.删除所有驱动器数据。
  3. reopen the project in correct XCode error is fixed !!!!!!在正确的 XCode 中重新打开项目错误已修复!!!!!!

The thing to consider here is the *.pch file.这里要考虑的是 *.pch 文件。 If you're doing an include from an external library then you have to make sure you're doing the include after #ifdef OBJC and before #endif.如果您从外部库进行包含,那么您必须确保在#ifdef OBJC 之后和#endif 之前进行包含。 If you try to do your include outside this condition this might be a cause of the compiler error.如果您尝试在此条件之外进行包含,这可能是导致编译器错误的原因。

Had this happen in a team using git.如果这发生在使用 git 的团队中。 One of the team members added a class from an external source but didn't copy it into the repo directory.其中一名团队成员从外部源添加了一个类,但没有将其复制到 repo 目录中。 The local version compiled fine but the continuous integration failed with this error.本地版本编译正常,但持续集成因此错误而失败。

Reimporting the files and adding them to the directory under version control fixed it.重新导入文件并将它们添加到版本控制下的目录修复了它。

I too had this error.我也有这个错误。 But in my case, and I'm sure I'll be a one off here, I had accidentally deleted main.m when I hit the delete key after the app had crashed on the iPhone simulator.但在我的情况下,我确信我会在这里失败,当我在应用程序在 iPhone 模拟器上崩溃后按下删除键时,我不小心删除了 main.m。

After a crash, Xcode shows the main.m file and when I had hit delete, I had accidentally deleted the main.m file from my project, as it is easy to do when a file name is highlighted, not the code in the detail view.崩溃后,Xcode 显示 main.m 文件,当我点击删除时,我不小心从我的项目中删除了 main.m 文件,因为突出显示文件名时很容易做到,而不是细节中的代码看法。

Main.m normally resides in a group or folder named supporting files in the project file manager. Main.m 通常驻留在项目文件管理器中名为支持文件的组或文件夹中。 I had not noticed this happened until it failed to build and run next time around and then I had to re-read the error message more closely and saw it said main.m is missing.我没有注意到这种情况,直到下次它无法构建和运行,然后我不得不更仔细地重新阅读错误消息,看到它说 main.m 丢失了。

Thank you all for your input, but just in case there is someone in my position check for any file names in red showing missing files and restore them from a backup if you have it.谢谢大家的意见,但以防万一有人在我的位置检查任何显示丢失文件的红色文件名,如果有的话,可以从备份中恢复它们。

将丢失的文件(Xcode->target->Build Phases->compiled sources 中的红色文件)添加到目标文件夹为我解决了这个问题。

My problem was that under Build Phases -> Compile Sources, I added a compiler flag for a file, but I had misspelled it.我的问题是在 Build Phases -> Compile Sources 下,我为文件添加了一个编译器标志,但我拼错了它。 It was supposed to be:它应该是:

-fno-obj-arc

to show that this file does not use ARC.表明此文件不使用 ARC。

May be it will be helpful for someone: I had the same error after deleting several files from project.可能对某人有帮助:从项目中删除多个文件后,我遇到了同样的错误。 After having deletes committed in git repository this error has gone...在 git 存储库中提交删除后,此错误消失了...

Xcode 8 Xcode 8

@Spoek's answer is right, @Spoek 的回答是对的,

But If you won't find file in red color , then find the one with low opacity,但是如果你找不到红色的文件,那就找一个不透明度低的,

see this image,看到这张图,

在此处输入图片说明

The first one is there but second one is note there, so delete it.第一个在那里,但第二个在那里,所以删除它。

My case, I fix it by:我的情况,我通过以下方式修复它:

Go to Build Phases and check Compile Sources files, check if it has duplicate file, just keep one.转到Build Phases并检查Compile Sources files,检查它是否有重复的文件,只需保留一个。

In my case it was a duplicate Swift Flag entry inside my Target's Build Settings > Other Swift Flags.在我的情况下,它是我的 Target 的 Build Settings > Other Swift Flags 中的重复Swift Flag条目。 I had two -Xfrontend entries in it.我有两个-Xfrontend条目。

In my case,就我而言,

Build Phases -> check Compile Sources files -> delete xxx.swift files that xcode says "can't find "xxx.swift"构建阶段->检查编译源文件-> 删除 xcode 说“找不到“xxx.swift”的 xxx.swift 文件

This happened to me and it took me an hour to find it.这发生在我身上,我花了一个小时才找到它。 In my case I had typed too fast and did:就我而言,我打字太快了:

[seld method];

instead of:代替:

[self method];

Seriously!严重地! I don't know why it didn't catch this in a more recognizable way.我不知道为什么它没有以更容易识别的方式捕捉到这一点。 But it was of course looking for a class called "seld".但它当然是在寻找一个叫做“seld”的类。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang失败,退出代码为1 - Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1 Xcode 10.0 错误“Command /Applications/Xcode 10.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc 失败,退出代码为 1” - Xcode 10.0 Error "Command /Applications/Xcode 10.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1" 命令 /Applications/Xcode-beta.app/Contents/Developer/usr/bin/actool 失败,退出代码为 255 - Command /Applications/Xcode-beta.app/Contents/Developer/usr/bin/actool failed with exit code 255 错误:命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang失败,退出代码为1 - error:Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1 命令/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang失败,退出代码为1 - Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1 为什么显示此错误消息“命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang失败,退出代码为1” - Why show this error message “Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1” 命令 /Developer/usr/bin/ibtool 失败,退出代码为 10 - Command /Developer/usr/bin/ibtool failed with exit code 10 命令/ Developer / usr / bin / dsymutil失败,退出代码为10 - Command /Developer/usr/bin/dsymutil failed with exit code 10 Xcode签名失败命令/ usr / bin / codesign失败,退出代码为1 - Xcode Signing Failed Command /usr/bin/codesign failed with exit code 1 命令/ usr / bin / lipo失败,退出代码为1 - Command /usr/bin/lipo failed with exit code 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM