duplicate symbol _OBJC_METACLASS_$_ClassName

前端 未结 18 1918
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 15:10

I am trying to run my cocos2d application and facing this error, as I have recently upgraded my sdk to 4.2 and my cocos2d to 0.99.5.

I tried to clean my project even

相关标签:
18条回答
  • 2020-12-15 15:41

    Check the Compile Sources of your target and see if a class.m file is included twice

    0 讨论(0)
  • 2020-12-15 15:43

    A stupid mistake that I made was that I named my @implementation the same as my superclass.

    In the .h

    @interface Subclass : Superclass
    @end
    

    In the .m

    #import "Subclass.h"
    
    @implementation Superclass
    @end
    

    None of the regular suggestions from google seemed to help, so if someone is as crazy or tired as I am (maybe a healthy mix of both), make sure you haven't duplicated an @implementation!

    0 讨论(0)
  • 2020-12-15 15:44

    XCode Beta crashed for me while deleting a reference to a class. This caused the problem described in the answer, the fix was different again.

    In my Target's Build Phase, under "Compile Sources", the item giving me grief was red. I couldn't remove it with the minus button, but typing "skip" in the compiler flags caused the red class to disappear after reloading the project. I'm assuming you could type anything in there.

    It took me two hours to find the solution to my prob, I put it in here for another option to those having this problem, although it is probably not going to be a common one.

    0 讨论(0)
  • 2020-12-15 15:46

    To me, removing -all_load from 'Other Linker Flags' fixed the problem.

    0 讨论(0)
  • 2020-12-15 15:51

    None of the Answers worked for me, so what I did was remove the files from the project and choose only Remove References.

    Then I added back the same files and it worked.

    That fixed my error. Maybe XCode got lost references stored somewhere since the project is multi-collaboration.

    Hope that helps someone.

    0 讨论(0)
  • 2020-12-15 15:52

    In my case, I had added the libxxxx.a to Link Binary with Libraries section in the subProjects as well as in the mainProject. Hence there were duplicate symbols. Removing from subProjects fixed it.

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