Re: Standard C++ Includes For iPhone
Re: Standard C++ Includes For iPhone
- Subject: Re: Standard C++ Includes For iPhone
- From: David Rowland <email@hidden>
- Date: Sat, 6 Feb 2010 16:57:47 -0800
On Feb 6, 2010, at 12:20 PM, Andreas Grosam wrote:
>
> On Feb 4, 2010, at 11:12 PM, Nick Nallick wrote:
>
>> I'm trying to use GCC 4.2 for an iPhone 3.1 project which contains C++ code. It works fine building for the simulator but I can't build for the device. When I include <exception> I get an error indicating that <bits/c++config.h> can't be found.
>
> When using C++ in Objective-C files (file extension: .m) you need to "activate" the Objective-C++ compiler. Simply rename the extension to .mm. Xcode will invoke the Objective-C++ compiler.
>
> Using C++ within Objective-C++ isn't without traps and catches, though. So, you're better off reading the corresponding documentation carefully.
Right, but I have had very little trouble doing this. I try to keep the C++ and ObjC code as separate as possible. C++ objects are not ObjC objects, and C++ exceptions are not ObjC exceptions. Run with C++, but when the ObjC code needs something, return it as an ordinary struct or simple variable.
Parts of the OS use a simple C interface, for example OpenGL. I used C++ there with no unexpected side effects.
_______________________________________________
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