 |
 |
Creating Custom Views...and importing custom classes
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
I have a custom class I've designed, but whenever I add the line 'import "class.m"' to my 'controller.h' file, I get this error:
ld: multiple definitions of symbol .objc_class_name_SDWorkBookView
and a "build failed" error.
Am I putting it in the wrong place or what?
Also, I am trying to create a custom view. What a pain!
Are there any good tutorials for this process? I want to make something that resembles the download manager in OW, only with custom displays (*of variable size*) in place of the uniform download items.
Thanks
|
|
you are not your signature
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Originally posted by Gametes:
I have a custom class I've designed, but whenever I add the line 'import "class.m"' to my 'controller.h' file, I get this error:
ld: multiple definitions of symbol .objc_class_name_SDWorkBookView
and a "build failed" error.
Am I putting it in the wrong place or what?
It's kind of unusual to import an implementation file. Why are you doing this? That's most likely what's leading to the error.
(Last edited by Chuckit; Nov 26, 2002 at 04:42 PM.
)
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
Originally posted by Chuckit:
It's kind of unusual to import an implementation file. Why are you doing this? That's most likely what's leading to the error.
Just to clarify, you usually import the interface file
#import "class.h"
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
But "class.h" doesn't import "class.m"; in fact it's the other way around. So you're telling me that at no time does "class.m" ever make its way into the stream? Pretty counterintuitive!
Well, that fixed it, so I'll just move on and try not to think about what magical means the compiler uses behind my back to get the .m file in the final product.
|
|
you are not your signature
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
As you'll see in this mockup, the 'class.m' file has NO "to" arrow connecting it to the program.

|
|
you are not your signature
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
This is absolutely correct, and makes perfect sense if you think about it for a sec.
When you call a function (or a class method, or whatever), you don't need to know how it works, you just need to know how to call it. Importing the ".h" file gives you the information about what's needed to call the function, without telling you anything about how it works.
Later, when you're compiling your code, the compiler says, "Hey, this wacky programmer is trying to use a method named 'DoEverythingAtOnce'. Do we have an implementation for that anywhere? Ah yes, there it is."
And it links it to the calling code.
Ya dig?
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
It just looks as though the .m file isn't in there anywhere, since the header file doesn't import it (what it should do). But I can live with it.
Anybody got an answer to my first need, about the custom view?
|
|
you are not your signature
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|