Duplicate character _OBJC_METACLASS _ $ _ ClassName

I am trying to run cocos2d application and encounter this error since recently I updated my sdk to 4.2 and my cocos2d to 0.99.5.

I tried to clean my project, even changing the deployment of Target ios, but the error remains the same. Also rename the class name in the same way to avoid duplication from the class names of the cocos2d library.

ld: duplicate the _OBJC_METACLASS _ $ _ MenuSceneNew symbol in / Users / umaidsaleem / Desktop / functionalityTest / assemblies / Debug-iphonesimulator / libcocos2d libraries.a (MenuScene.o) and /Users/umaidsaleem/Desktop/functionalityTest/build/functionalityTest.build Debug-iphonesimulator / functionalityTest.build / Objects-normal / i386 / MenuScene.o

+42
objective-c cocos2d-iphone
Mar 17 '11 at 10:17
source share
17 answers

You double-link the MenuScene.m file. You apparently have it in the static library as well as in your main application.

+49
Mar 17 2018-11-11T00:
source share
โ€” -

Another pretty simple thing is to check that you are by no #import a .m , and not the .h header file.

It happened to me.

+162
Sep 15 '11 at 15:08
source share

Another reason for this, for those who did the same as I did, might be that you recreated the managed object class. By doing this and choosing another group in the project structure, you accidentally create another link to the same files.

I ended up with two links for the title and implementation both in the project root and in my model group. Removing the top links to the .h and .m files eliminated the communication failure.

+37
Jul 18 '12 at 21:29
source share

Sometimes Core Data inserts AnyProjectNameModel.xcdatamodeld into compilation phases of assembly phases. Check it and delete, and everything starts again ... The error message simply indicates the generated ManagedObjects ... The right place for AnyProjectNameModel.xcdatamodeld is the Copy Bundle resources in the build steps. enter image description here

+20
Jul 19 '16 at 22:36
source share

Check the compilation sources of your target and see if the class.m file is included twice

+14
Oct 23 '13 at 9:33
source share

The stupid mistakes I made are what I called my @implementation the same as my superclass.

In .h

 @interface Subclass : Superclass @end 

In .m

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

None of the usual google recommendations seemed to help, so if someone is as crazy or tired as I am (possibly a healthy combination of both), make sure you don't duplicate @implementation !

+5
Jul 15 '14 at 3:58
source share

I also had this particular error when a file that was not added to the project is mentioned somewhere in the project. In two cases, when I came across this, I deleted / deleted files from the project without deleting the links to them, and when working together on a project where a team partner added a link, but I did not add the file to my version of the project.

I know that the OP solved their problem, but I felt that it could help someone who reads this question looking for help.

+2
Aug 15 '11 at 15:03
source share

Another thing to check for double-linking is that you can have the same file in two different places in the file list on the left. The compiler then compiles and bundles it twice.

This happens, for example, when organizing a file hierarchy.

You donโ€™t need to create a library or something interesting - just drag and drop .m to two different places in the project tree.

Do not forget to delete the link to only one of them; file deletion is not required.

+2
Sep 18
source share

I got -all_load removed from 'Other Linker Flags'.

+2
Feb 10 '15 at 19:37
source share

I myself figured out the solution, I apologize for the slight delay in sending. All help is much appreciated, but the problem arises when I add a new CCLayer class and checkmark cocos2d 0.99.5 static library, which was incorrect. Then I re-declare my class without checking and clearing my goals, and then I donโ€™t build or leave. The problem is resolved now.

+1
Mar 18 '11 at 10:26
source share

Xcode Beta crashed about me by deleting a class reference. This caused the problem described in the answer, the fix was different.

In my target build phase, under the Compilation Sources section, the item that gives me sadness was red. I could not delete it using the minus button, but by typing skip in the compiler flags, the red class will disappear after reloading the project. I guess you can type something in there.

It took me two hours to find a solution to my problem, I added it here for another option for those who have this problem, although this probably won't be common.

0
Aug 26 '12 at 14:57
source share

None of the answers worked for me, so I deleted files from the project and selected only โ€œDelete linksโ€.

Then I added the same files back and it worked.

This fixed my mistake. Xcode may have lost links stored somewhere, as the project is multi-component.

Hope this helps someone.

0
Aug 08 '13 at 15:30
source share

Another possibility for error, for example, arises when class names collide. Either 2 classes with the same name in your project, or a class from your project when faced with one that is defined in some dependency libraries.

0
Dec 19 '13 at 10:49 on
source share

Remove the target from the right pane and add the target again. This will remove duplicate links. This can happen if 2 programmers add the same goal and commit the project file.

0
May 07 '14 at 12:44
source share

In my case, I used a binary library that included the same class name that I used outside, so I changed the name of my class and it works fine :)

0
Nov 26 '15 at 10:20
source share

I had a project with two goals. An object named Component, and the second is Sample. The sample used the component as a reference library. The Component then used a block called MyPod (installed with cocoapod).

The signature was written as follows:

 def shared_pods pod 'MyPod' end target 'Component' do shared_pods end target 'Sample' do shared_pods end 

Both goals referred to a general list of subcategories. There is no problem creating the target component, but when I create the sample, I get a duplicate of the _OBJC_METACLASS _ $ _ ClassName symbol. I changed the Subfile to:

 def shared_pods # empty end target 'Component' do pod 'MyPod' shared_pods end target 'Sample' do shared_pods end 

And that solves the problem. 3 hours have passed, we hope to save someone time.

0
Jun 14 '16 at 11:30
source share

In my case, this was because Xcode automatically generated the NSManagedObject class, which then collided with my manually created NSManagedObject class. In this case, you can set "Codegen" to "Manual / None" in the Data Model Inspector for your newly created object.

0
Nov 15 '17 at 12:24
source share



All Articles