duplicate symbols for architecture i386 clang

后端 未结 24 1060
悲哀的现实
悲哀的现实 2020-11-29 20:33

I\'ve seen several posts on google and stackoverflow related to this error, I\'ve read all of them but still fetching the problem , I will be glad for a solution. Here is th

相关标签:
24条回答
  • 2020-11-29 20:50

    In certain cases you can also get a "duplicate symbols for architecture..." error due to the fact that you accidentally declared a constant (const) with the same name in two different files.

    0 讨论(0)
  • 2020-11-29 20:51

    Another reason this error often happens is accidentally importing the .m file instead of the .h.

    0 讨论(0)
  • 2020-11-29 20:53

    If other people have tried all the other answers and it still isn't working, try opening up the .xcodeproj file with your favorite text editor and searching for the name of the class that's giving you trouble. Make sure you close Xcode before doing this. In the file, there should be one line for the .h and another line for the .m. If there are duplicates, remove them, save the file, and re-build.

    0 讨论(0)
  • 2020-11-29 20:53

    I had that problem and I was stuck for a while. The thing for me that caused the problem was I wrote some boolean into .h file (between #import and @interface) and use them into my .m file

    I simply deleted them from my .h file and and copied them into the same place into my .m file and the build succeed.

    0 讨论(0)
  • 2020-11-29 20:55

    Easiest way to resolve this is issue Xcode 7.0 or latter just change no Common Blocks to NO it will solve your problem try this Project Target > Build Setting > No Common Blocks, i change it to NO.

    0 讨论(0)
  • 2020-11-29 20:56

    I had this issue with a framework that I knew worked in another project. I had copied the files from the other project and added it to this one. Then when building I got 76 duplicate errors.

    The simple solution for me was removing -ObjC from Other Linker Flags. The previous project did not have that. Once I did that, the warning disappeared and the project built successfully.

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