Duplicate Symbol Error in Objective-C build?

前端 未结 17 2002
礼貌的吻别
礼貌的吻别 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:08

    I had a similar problem due to poor defining of consts. I had defined a const in my header:

    int const kCropLocationTop = 1;
    

    This was presumably imported multiple times. To fix i changed the header def as follows:

    extern int const kCropLocationTop;
    

    and moved the assigning of the const to the .m file:

    int const kCropLocationTop = 1;
    

    Hope that helps anyone who's as ignorant of simple objective c concepts as I am!

提交回复
热议问题