Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the location of duplicate symbol

I have several files listed in compile sources and it doesn't want to sort by name so I'm stuck having to sort through them by hand looking for duplicates. Is there an easier way to do this? It's only ~100 files but it would be nice to know a more efficient way.

Error example:

...
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
    /Users/xxxx/Library/Developer/Xcode/DerivedData/JOMiPhoneApp-ginylosefnqdjpfprrdipmpewzun/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/AppDelegate-215945057A88172.o
ld: 34 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
like image 921
Jacksonkr Avatar asked Jan 09 '23 00:01

Jacksonkr


2 Answers

If you pull up the report navigator, select the build with the warning, and then expand the console details for the failed compile, it should describe precisely where both of the duplicate references are (in my example, in AppDelegate.o and ViewController.o, the latter because I "accidentally" did an #import of AppDelegate.m rather than AppDelegate.h in ViewController.m):

enter image description here

In the project navigator in left panel, click on the search tab and look for AppDelegate. Anyway, you can search through your entire project like so:

enter image description here

You can also search for a symbol by typing command+shift+O (the letter "Oh"):

search for symbols

This last approach will only find it if you have the AppDelegate symbol defined in different source files, but it's another avenue to consider.

like image 77
Rob Avatar answered Jan 19 '23 06:01

Rob


Click on the Report Navigator tab in Xcode (command8), then click on the build that shows the red build error icon. It should show you more specifically where it is finding the error. If you want even more information, click the “hamburger”-style button on the right:

screenshot showing hamburger button

like image 36
Zev Eisenberg Avatar answered Jan 19 '23 05:01

Zev Eisenberg