Re: Linking Against stdlibc++
Re: Linking Against stdlibc++
- Subject: Re: Linking Against stdlibc++
- From: David Frantz <email@hidden>
- Date: Thu, 07 Jul 2011 11:30:19 -0400
You bring up a good question. Would it not make more sense to use #3. Personally I would think that #1 would be the worst choice. Why? Because you impact the way the compiler sees the file. Plus if you are writing in Objective C it is a bit misleading to indicate that the file is an Objective C++ file. It would be like opening a dot-sh file to find Python code inside.
I'm sure others will pipe up it will be very interesting to see the reasoning. By the way I'm far from an expert Mac programmer so take my comments with a grain of salt.
As to build settings, why the aversion to changing them? Isn't the whole point of "build settings" to configure XCode to build a proper app?
Sent from my iPad
On Jul 7, 2011, at 6:35 AM, Andreas Grosam <email@hidden> 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.
>
> 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?
>
>
> Thanks for tips!
>
> Regards
> Andreas
> _______________________________________________
> 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
_______________________________________________
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