简体   繁体   中英

linker command failed in Xcode

I was building an app, but later on I quickly changed something(a value in char variable) and tried to load again, now I am getting this error

ld: 9 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have undone what I have done, but still I am getting this error. I have tried to delete build folder, it did not work... I also performed clean and build but still it cannot build...

You have to check the files included in the build. Quite possibly there are some duplicate implementation (or perhaps header?) files included.

  1. Navigate to {Project} > {Target} > Build Phases .
  2. Check the Compile Sources build phase for duplicates.
  3. Remove all duplicate files.

Also make sure no duplicate libraries are included in the project. You may check this in the Link Binary With Library phase. Basically same story as above, but for libraries.

Finally make sure to clean the project before building ( Product > Clean ).

My error message was a little different - duplicate symbols ... in ClassImplmentationFile. m

I didn't have any of the duplicates, as described above, but I noticed that the .m files that were listed in the error message, were in Build Phases/ Compile Sources.

I removed them from there and the thing ran fine.

I didn't put them in there. I guess Xcode auto-screwed-up my project at some point. : - )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM