“File not found”, “linker command failed with exit code 1” in Xcode 4.5.1
Solution 1
Steps to resolve:
- Create new scheme with different name
Delete old scheme
Add new scheme
Where the problem came from:
I changed my product name and disabled the snapshot option. Then, suddenly, this error popped out:
ld: file not found:.././previousproductname.app/previousproductname
Steps I followed unsuccessfully to debug:
Deleted deriveddata, restarted Xcode. - not resolved.
Followed the steps of this: link http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/ - same error; not resolved.
Finally, I changed the Scheme name, deleted my old scheme and added new, have solved my issue.
Solution 2
I encountered the same error message. Turned out I had renamed my app target and had not updated the test target, Build Settings, Bundle Loader setting to my new app name.
More details on this setting can be found at Adding Unit Tests to an existing iOS project with Xcode 4 I reviewed the same steps and it helped me fix my project in Xcode 5.
Solution 3
You must have changed your product name. Due to mis-match of your workspace name and product(application)name this error occurs.
You just need to replace the workspace name to product(application) name in the TEST HOST Build settings of the ProjectName-Tests targe as stated in the image. To catch up that, select to ProjectName-Tests target, select Build Settings, search for the Test Host term.
This is the standard configuration solution for this error.
Cheers!!
Solution 4
Delete your scheme then re-create it (click new icon or using autocreate of xcode). It works for me.
Solution 5
On xcode 6 you need to:
- go to products folder
- click on file .xctext
- on "TARGETS" choose Tests
- and on Host Application choose your application.
- Click build app.
Works for me!
Comments
-
Yuvaraj.M about 4 years
Am developing an existing iOS application and I have to write unit test cases for this project. It is building and running in Simulator 6.0. Whenever I try to test the project, it is showing the error message below. Am not able to figure the exact error.
id: file not found: /Users/Yuva/Library/Developer/Xcode/DerivedData/FlyApp-aexukpgtbathuadgxlnm/Build/Products/Debug-iphonesimulator/FlyApp.app/FlyApp clag: error: linker command failed with exit code 1 (use -v to see invocation)
Could you please help me to solve this linker error and test the app?
-
Yuvaraj.M about 11 yearsHi. Am not able to see /Users/Yuva/Library/ because inside of Yuva folder the Library is missed. What shoul i do to get resolve this issue? Can you plesae help me? thanks.
-
Owen Hartnett about 11 yearsFor some reason, the code you wrote thinks that there is a file there. I know that sometimes the DerivedData folders get messed up, and perhaps looking at Xcode's Preferences->Locations menu item might clear it up.
-
Yuvaraj.M about 11 yearsThank you for your reply. Now I got the Derived Data folder followed by your guide. There are many folders with Build, Index, info.plist, Logs, scm.plist and TextInex. May i deleted the DerivedData folder items? Please help me. Thanks.
-
Yuvaraj.M about 11 yearsI tried to delete all the items in DerivedData folder and restarted the Mac. Again when I tried to "Test" the app it is showing the same error. I don't have idea to resolve this issue. Could you please help me? Thanks.
-
Albert Renshaw almost 10 yearsIt's not that the library folder is missing, it's that it's hidden... you have to turn on view hidden files in finder through terminal.
-
Albert Renshaw almost 10 yearsAnd the in finder select "view file path" or "path bar" or something, then select hidden folder "library" then on the bottom path bar double click on "*~ --> Library"
-
derpoliuk over 9 yearsI had this issue after renaming. Changing
Bundle Loader
in Test Target Build Settings helped me fix it. -
arnold over 9 yearsthis works for me, my god ive been banging my head just to fix it, Thanks
-
Aron Lorincz over 9 yearsSame here: someone renamed the app, and the linker was still looking for the old one.
-
user1154390 over 9 yearsI had same problem - Create a new scheme works for me. Steps in XCode 6 Go to PRODUCTS TAB then go to SCHEME and then go to MANAGE SCHEME PRESS Minus sign and then + to create new scheme.
-
Josh over 9 yearsThis worked for me. For newbies like myself do persist in finding the "test target" from the "project settings". You will see immediately the erroneous "bundle loader" paths in the "linking" section, but this was not the source of my error as these entries refer to a "$(TEST_HOST)". Scroll down to the "testing" section and fix the "test host" entries and this will update the linking section.
-
Nikhil Lihla over 9 years@haotang you are a life saver... Thankyou very much... i have tried so many solutions but nothing worked except this... Ty :)
-
SmileBot over 9 yearsCreating a new scheme did it for me. In my case I pulled down my project to a new machine from bitbucket.
-
user3204765 about 9 yearsThis works for me too. Wonder why there isn't simple way to delete the DerivedData and re-create them.
-
Daniel Shin about 9 yearsYou saved my day! Creating a new scheme indeed works! I love SO so much.
-
Mihir Mehta about 9 yearsFYI ... It's available in your Test Target's build setting under Linking section (Xcode 6.3.2)
-
Kuldeep almost 9 yearsAlways my pleasure @ThomásC. :)
-
Bruce almost 9 yearsThis is it.. happened to me when I add a space in the Product name. Remember to you must change not only one name but two in the same path, e.g. from FlyApp.app/FlyApp to abcd.app/abcd
-
Joakim M almost 9 yearsKing! New Scheme = Work!
-
Crashalot almost 9 yearsOnly worked for us by clicking "plus" icon, not by using autocreate.
-
Viktor Nilsson almost 9 yearsThe old Scheme for me too that was the problem. Removing it and creating a new one resolved the problems for me as well. Thanks!
-
loomer almost 8 yearsUpdating the Test Host fixed this issue for me.
-
JastinBall over 7 yearsPerfect solution!
-
FortuneCookie over 4 yearsits about XCode 4.5!
-
shyam_ssr over 4 yearsit is to help someone who lands in this page with recent xcode's.
-
cherucole over 4 yearsSuch a life saver. Ran into the problem while building a react native app too, had to just create a new scheme in 'manage schemes'. Created a new scheme and unchecked the old one then it worked