On Jun 25, 2009, at 11:46 AM, WT wrote:

On Jun 25, 2009, at 11:38 AM, Dave Keck wrote:

The link error is pretty self-explanatory. To solve issues like this,
I'd first change the header like so:

  extern NSString *const someString;

and create a SharedDefs.m:

  NSString *const someString = @"halla";

This way, any object file can reference someString, but only one
object file will actually define it - SharedDefs.m. And voila, link
errors be gone.

David

Hi David,

I understand the message, and I thought of the solution you suggested. What I'm puzzled with is that I thought #import only imports once.

Wagner

Duh... never mind. The header *is* being imported only once, per .m file. That's not the problem. The problem is that

NSString* const someString = @"foo";

creates two strings with the same reference name, one for AppDelegate and one for SomeClass. It wasn't until I typed the message above that I realized my mistake.

I think I should go have lunch now. My brain is lacking some food....

Wagner
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to