duplicate symbol _OBJC_METACLASS_$

Joined
Oct 7, 2009
Messages
14
Reaction score
0
Points
1
Location
Singapore
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.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Import the .h file.

I think what has happened is that your project already knows to compile the .m file. By including it in another source file, you are asking the compiler to compile it inline with that other source file, so the compiler sees it a second time, hence the duplicate symbol.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top