Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Creating Custom Views...and importing custom classes

Creating Custom Views...and importing custom classes
Thread Tools
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status: Offline
Reply With Quote
Nov 26, 2002, 03:30 PM
 
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
Reply With Quote
Nov 26, 2002, 04:33 PM
 
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
Reply With Quote
Nov 26, 2002, 05:02 PM
 
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.
     
Gametes  (op)
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status: Offline
Reply With Quote
Nov 26, 2002, 06:16 PM
 
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
     
Gametes  (op)
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status: Offline
Reply With Quote
Nov 26, 2002, 06:29 PM
 
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
Reply With Quote
Nov 26, 2002, 07:38 PM
 
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.
     
Gametes  (op)
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status: Offline
Reply With Quote
Nov 26, 2002, 09:05 PM
 
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
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2