• 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: Linking Against stdlibc++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking Against stdlibc++


  • Subject: Re: Linking Against stdlibc++
  • From: Scott Thompson <email@hidden>
  • Date: Thu, 07 Jul 2011 07:23:03 -0500


On Jul 7, 2011, at 5:35 AM, Andreas Grosam wrote:

Hello, 

A static library project (for iOS) with an Objective-C interface uses internally a C++ implementation.


When creating an Objective-C application, I would like to keep the app project as less modified as possible when linking against the static library. Well, usually this requires the application to be linked against the C++ library, that is libstdc++.

It seems, I have these alternatives:

1) rename the main.m file to main.mm and the app project automatically links agains libstdc++.
2) add to "Other Linker Flags" the option "-lstdc++" of the target settings of the application.
3) add the libstdc++.dylib in the "Link Binary With Libraries" section of the Build Phases in the target settings of the application.

I prefer option 1) as it seems the most reliable method, for several reasons

Option 1 is certainly the most obscure.  I wouldn't expect the build system to automatically link against a library just because of the type of my main file.

However, is there any better way, possibly one which does not require to add/change application build settings or modifies any of the applications source files?

You're going to have to change _something_ in order to get the library linked to your application.  Other than the options you've mentioned (my favorite being option 3), the only other way I can think to accomplish this is to link libstdc++ with some other static library that is already being included in the application.

Scott

 _______________________________________________
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: 
 >Linking Against stdlibc++ (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: C++ to Low level language
  • Next by Date: Fw: C++ to Low level language
  • Previous by thread: Linking Against stdlibc++
  • Next by thread: Re: Linking Against stdlibc++
  • Index(es):
    • Date
    • Thread