xcodebuild failure clang:error no such file or directory: xcodebuild failure clang:error no such file or directory: xcode xcode

xcodebuild failure clang:error no such file or directory:


To fix this, go to your project settings, go to Targets and select your main project target. Then go to Build phases. Under Target dependencies add the static library project.

This way, when you compile the main project, the static library subproject gets compiled before the main project and your static library will be available.


I had the same problem, but for a resource file .m

I opened target -> build phases -> Compile sources

and I found the file the compiler was tell it can't find duplicated: one with strange icon and the other with a normal icon. I simply removed the one with strange icon and it worked. ( I added the file multiple times and I had a merge conflict before that which made something wrong in the project file)

For your case I think you need to remove the lib from target dependencies list and add it again. This may work for you.


In Xcode Version 9.2 (9C40b) this happened when I drug a bunch of files into the project, some of which were duplicate. Rather than simply not adding the duplicates, it added them again and only the name, not the path.

In Target > Build Phases > Compile Sources each of the duplicates showed with no "...in" after them. Each one caused the clang error.

enter image description here

After removing all of the duplicates that Xcode collected, the project compiled and ran.

It makes you use the Project Navigator instead of managing your source files in the Finder. Then the Project Navigator can't replace duplicates like any decent file management system (ahem Finder). 🤨