• 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: Multiple targets, multiple definitions of symbol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple targets, multiple definitions of symbol


  • Subject: Re: Multiple targets, multiple definitions of symbol
  • From: Camillo Lugaresi <email@hidden>
  • Date: Thu, 5 Jan 2006 11:57:13 +0100

On 05/gen/06, at 11:01, Joachim wrote:

I have an Xcode project with two targets. One is included in the other. They share some code, amongst others a header file with a bunch of NSDictionary keys defined as NSString pointers. When the compiler links the last target (that includes the first), I get "multiple definitions of symbol xyz" for all the NSString* constants.

Don't define globals in a header file, or you will have a definition for each implementation file that includes the header. Declare them in a header, and define them in one single implementation file.


globals.h:
extern NSString *const MyDictionaryKey;

globals.m:
NSString *const MyDictionaryKey = @"mykey";

Camillo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Multiple targets, multiple definitions of symbol (From: Joachim <email@hidden>)

  • Prev by Date: Globaly unique NSManagedObjectID
  • Next by Date: Re: Checkboxes in Table Views
  • Previous by thread: Multiple targets, multiple definitions of symbol
  • Next by thread: How to create Daemon for Mac 10.4
  • Index(es):
    • Date
    • Thread