• 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 definitions errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple definitions errors


  • Subject: Re: multiple definitions errors
  • From: Dan Korn <email@hidden>
  • Date: Thu, 26 Jun 2008 15:18:45 -0500

On Jun 26, 2008, at 12:21 PM, Jean-Daniel Dupas wrote:

Create a "dynamic library" target instead of the "static library" target that was previously created. There are some settings defined by the target type.

Thanks Jean-Daniel! You're right, there are some hidden settings in the project file that aren't accessible through the Xcode 2.5 IDE. It turns out that my project.pbxproj file also had this line in it:


   productType = "com.apple.product-type.library.static";

Rather than recreating the entire target from scratch, I tried changing this line in a text editor to:

   productType = "com.apple.product-type.library.dynamic";

Then I saved the file, re-opened the project in Xcode and, voilĂ , now my Target builds a dynamic library. (It actually uses Ld instead of "Libtool -dynamic", but it seems to be doing the right thing.)

I suppose the obvious question here is, what exactly is the purpose of the "Mach-O Type" setting? In the little blurb window in the Build Settings, it says, "This setting determines the format of the produced binary and how it can be linked when building other binaries. [MACH_O_TYPE]." But changing the setting seems to have no effect at all.

The online documentation even says that this setting should work, and allow you to change the binary output type after the target has been created:
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeUserGuide/Contents/Resources/en.lproj/05_08_bs_linking/chapter_36_section_2.html


The Mach-O Type (MACH_O_TYPE) build setting allows you to specify the type of binary a target produces. By default, this build setting is set to the appropriate value depending on the target’s type. For example, in a Cocoa static library target, Mach-O Type is Static Library; in a BSD dynamic library target, Mach-O Type is Dynamic Library. However, you can change Mach-O Type for a target when you need a different binary type than the target default. For example, if you want to implement a Cocoa plug-in as a dynamic library instead of a bundle, create a Cocoa-bundle project and change Mach-O Type from Bundle to Dynamic Library.


Does this problem still exist in Xcode 3? Should I file a bug? I haven't been able to find much about this issue online. At least maybe next time someone else runs into an issue with the "Mach-O Type" setting not actually doing anything, they might find this thread.

Thanks,
Dan

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


References: 
 >multiple definitions errors (From: Dan Korn <email@hidden>)
 >Re: multiple definitions errors (From: Dan Korn <email@hidden>)
 >Re: multiple definitions errors (From: Dan Korn <email@hidden>)
 >Re: multiple definitions errors (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: .jpg to .icns?
  • Next by Date: NDA, iPhone, etc.
  • Previous by thread: Re: multiple definitions errors
  • Next by thread: Error for FSReadFork
  • Index(es):
    • Date
    • Thread