On 3 Apr '08, at 7:08 AM, Daniel Child wrote:

I thought #import would take care of the possibility of duplication.

All "#" declarations are handled by the preprocessor, which is just a dumb macro engine that feeds its output into the compiler. The compiler itself just parses a single continuous stream of text, not caring what source file(s) it came from. So it makes no difference to the compiler whether you put something in a .h or a .m file.

Are you suggesting I need to separate the declaration of the function from the implementation, placing the implementation into a different file?

Yes, you have to. If you put the function body in a header, it gets compiled as part of every source file that #includes/#imports that header, which means you get multiple copies of the code, causing link errors.

Then I'm wondering why Xcode 3 would not accept it but Xcode 2 would....

Something else must be different, but it's probably not worth tracking down what; you just need to fix your source code. No offense, but you should consider (re)reading a C programming textbook, as this is basic stuff.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to