Imported from the Apple Support Forums via the Wayback Machine 🔗
Bracer Jack wrote: 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...
Did you mean to #import "MyClass.h" instead?
0
Apple Support Community member·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Yes it works ! But I had been practising on the pc using GNUStep for a while and one must link to the *.m file from the main file for only the implementation file links to the header directly.
Ok, change of mentality here. If this is how Xcode works...under what circumstances would one need to import the *.m file itself ?
0
Apple Support Community member·
Imported from the Apple Support Forums via the Wayback Machine 🔗
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.