• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa-dev Digest, Vol 5, Issue 533
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa-dev Digest, Vol 5, Issue 533


  • Subject: Re: Cocoa-dev Digest, Vol 5, Issue 533
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 3 Apr 2008 07:59:57 -0700


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@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: duplicate symbol error
      • From: Daniel Child <email@hidden>
References: 
 >Re: Cocoa-dev Digest, Vol 5, Issue 533 (From: Daniel Child <email@hidden>)

  • Prev by Date: Re: KVC - how to get properties into a common form?
  • Next by Date: Re: KVC - how to get properties into a common form?
  • Previous by thread: Re: Cocoa-dev Digest, Vol 5, Issue 533
  • Next by thread: Re: duplicate symbol error
  • Index(es):
    • Date
    • Thread