[iphone] 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

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

This question is related to iphone objective-c ios ipad

The answer is


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


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.


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"

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

  1. Delete drive Data
    a. In Xcode select preferences

enter image description here

  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

enter image description here

  1. Quit Xcode
  2. Delete all drive data.
  3. reopen the project in correct XCode error is fixed !!!!!!

In my case it was a duplicate Swift Flag entry inside my Target's Build Settings > Other Swift Flags. I had two -Xfrontend entries in it.


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.


In my case,

Build Phases -> check Compile Sources files -> delete xxx.swift files that xcode says "can't find "xxx.swift"


deleting ~/Library/Developer/Xcode/DerivedData helped me.

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.

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!


Do a clean. product > clean . Terminal purge & reboot didn't work for me, cleaning did.


Xcode 8

@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,

enter image description here

The first one is there but second one is note there, so delete it.


Go to target preferences, summary tab, find "Deployment target" and increase it.


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


My case, I fix it by:

Go to Build Phases and check Compile Sources files, check if it has duplicate file, just keep one.


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


Adding the missing files(files in red color in Xcode->target->Build Phases->compiled sources) to the target folder resolved the issue for me.


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


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.


The thing to consider here is the *.pch file. 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. If you try to do your include outside this condition this might be a cause of the compiler error.


Examples related to iphone

Detect if the device is iPhone X Xcode 8 shows error that provisioning profile doesn't include signing certificate Access files in /var/mobile/Containers/Data/Application without jailbreaking iPhone Certificate has either expired or has been revoked Missing Compliance in Status when I add built for internal testing in Test Flight.How to solve? cordova run with ios error .. Error code 65 for command: xcodebuild with args: "Could not find Developer Disk Image" Reason: no suitable image found iPad Multitasking support requires these orientations How to insert new cell into UITableView in Swift

Examples related to objective-c

Adding a UISegmentedControl to UITableView Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Warp \ bend effect on a UIView? Use NSInteger as array index Detect if the device is iPhone X Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3 ITSAppUsesNonExemptEncryption export compliance while internal testing? How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem? Change status bar text color to light in iOS 9 with Objective-C

Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to ipad

What is correct media query for IPad Pro? iPad Multitasking support requires these orientations How to restrict UITextField to take only numbers in Swift? How to present a modal atop the current view in Swift Presenting a UIAlertController properly on an iPad using iOS 8 Detect current device with UI_USER_INTERFACE_IDIOM() in Swift HTML5 Video tag not working in Safari , iPhone and iPad Install .ipa to iPad with or without iTunes How to hide UINavigationBar 1px bottom line How to fix UITableView separator on iOS 7?