duplicate symbol _OBJC_METACLASS_$

I created a basic command line Foundation Class Based object using the build in template.

I proceed to add a new "MyClass.m" & "MyClass.h" and everything compiles fine.

Now when I try to #import "MyClass.m" in the main file it says:
ld: duplicate symbol _OBJC_METACLASS_$_MyClass in MyClass.o and Link.o...

Please Help.
Thanks.

Macbook Pro, Mac OS X (10.6.1)

Posted on Oct 15, 2009 10:23 PM

Reply
3 replies

Oct 15, 2009 11:43 PM in response to Bracer Jack

Bracer Jack wrote:
If this is how Xcode works...under what circumstances would one need to import the *.m file itself ?

Never.

When one class needs to know about another, everything it needs to know should be in the @interface file. This is one of the core concepts of object oriented programming. The programmer should be able to change the @implementation of a class at any time without affecting the way other classes connect to it. The @interface file for a class defines the literal "interface" between that class and any other class. It should never be necessary for a programmer to see the @implementation of a class in order to use it properly.

\- Ray

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

duplicate symbol _OBJC_METACLASS_$

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.