Duplicate Symbol Error in Objective-C build?

前端 未结 17 1850
礼貌的吻别
礼貌的吻别 2020-11-27 14:12

I got this error when I press build+debug:

ld: duplicate symbol .objc_class_name_BlogTableItemCell in /Users/fabian/Development/Workspaces/iphone_experiments         


        
相关标签:
17条回答
  • 2020-11-27 15:15

    It seems that you are compiling the same BlogTableItemCell class two times in different places of your code. This may happen in the following cases.

    • You have put the same class implementation into two different files;

    • You actually have just one implementation of this class, however you are also linking in your project a framework or library containing a class whose name is exactly the same of yours.

    Try finding in the whole project your class and make sure only one copy is available within your project.

    0 讨论(0)
  • 2020-11-27 15:15

    One of our developers left the "libSoomla*" project files in there twice. I removed the duplicate soomla files, re-built, and that fixed it!

    Hope it helps.

    0 讨论(0)
  • 2020-11-27 15:17

    iPhone: Duplicate Symbol Error? by user576924

    answered it correctly for me. However to find the offending gremlin this ZSH snippet.

    grep "import.*\.m" **/*.[hm]
    

    Will immediately tell you where your error is.

    0 讨论(0)
  • 2020-11-27 15:17

    This may help someone

    I got this error because I duplicate a ViewController and then renamed it. So when I compile I got this error. The reason was in both of the view controllers there was a "float" variable with same name i.e "float padding=10.0" which I had defined on class level. Renaming the name of the above mentioned variable in One of the view controllers solved my problem.

    0 讨论(0)
  • 2020-11-27 15:18

    I just ran into this problem myself. For the list, here's another possibility:

    Duplicated linking line in the project file.

    I caused this merging conflicts on a SVN update, when I accidentally duplicated a line.

    0 讨论(0)
提交回复
热议问题