相关文章推荐
重情义的马克杯  ·  (八)Spring ...·  11 月前    · 
睿智的钢笔  ·  curl 设置超时时间 - ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

I'm trying to do an application reading pdf using pdf kit in Xcode 4.3 but it gives me the following error

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 ??

check your Build Phases > Compile Sources Remove the red-colored ones Also, check if you have duplicate import statements – Ore Sep 14, 2013 at 4:51

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.

Please provide more information. What if there is "Red Stuff"? This is not helpful at all... – werdsackjon Nov 4, 2013 at 16:16 Red colored files may present inside compile sources or copy bundle resources. I have edited the answer so. – Vineeth Jan 2, 2014 at 11:45 Sometimes you need to add the files to the project instead of deleting the references from "Compile Sources". – ULazdins Jan 29, 2014 at 7:45 Just for the record, NOT ALL red items seems to be unlinked! (For me this was the Main.storyboard and some libs, which remains red). I had some wrong paths in Build Settings – longi Oct 20, 2014 at 10:59 "Product > Clean" didn't work for me but "Product > Clean build folder..." did. (You see it when you hold the Alt key down whilst in the Product dropdown. – Adil Hussain Dec 2, 2014 at 11:12

I had this same error and nobody seems to have an answer on StackOverflow that actually works. 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. This means that when I went to pull the project from the repo, the .pch file was missing, thus throwing this error.

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.

Hope this helps?

@Esq in project navigator select your project (blue icon), next select target in main window (options there: project, target 1, target 2, ...). In main window find "Deployment target" and increase it to something modern (8.1 for example) – fnc12 Nov 4, 2015 at 11:39

I face this problem too. And ofc I looked for help in SO instead of use the common sense and check the error message.

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.

Happy coding!

You have accidentally included the .m file OverlayManager instead of the .h file inside the actual OverlayManager class itself! 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. But your case is unique, seeing as you are #importing the .m of the actual class' .m file! It's recursively compiling your OverlayManager class.

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.

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). 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 6.4 and XCode 7.3 are installed which are running Swift 1.2 and Swift 2.0. By mistake you tries to compile code with icorrect version for Ex. your project in in Swift 1.2 and you tries to compile it with 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. To resolve this

  • Delete drive Data
    a. In Xcode select preferences
  • Had this happen in a team using git. One of the team members added a class from an external source but didn't copy it into the repo directory. 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.

    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.

    Main.m normally resides in a group or folder named supporting files in the project file manager. 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.

    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.

    My problem was that under Build Phases -> Compile Sources, I added a compiler flag for a file, but I had misspelled it. It was supposed to be:

    -fno-obj-arc
    

    to show that this file does not use ARC.

    @Spoek's answer is right,

    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.

    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".