Re: how to include pure C++ header in obj-C in Xcode
Re: how to include pure C++ header in obj-C in Xcode
- Subject: Re: how to include pure C++ header in obj-C in Xcode
- From: Velocityboy <email@hidden>
- Date: Mon, 9 Aug 2010 23:17:35 -0700
Name your Obj-C source file ending in .mm rather than .m.
-- Jim
On Aug 9, 2010, at 11:01 PM, Wayne Shao wrote:
> Hi,
>
> I have a C++ util class (note: pure C++, it does not use obj-c objects in
> the C++ files).
>
> When I added the C++ classes to Cocoa project, it compiles fine.
> But when I add C++ include from the ObjC class, it gives all kinds of
> errors.
> (Note: this is different from what the guide describes here
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCPlusPlus.html#//apple_ref/doc/uid/TP30001163-CH10-SW1
> )
>
>
> What is the right way to include C++ headers from objc?
>
> // In objC class
>
> #include "my_util.h" (or #import "my_util.h")
>
> @interface MyObjC : NSObject {
> /// typical objc members skipped
>
> MyUtil* util_; // C++ object, compiling error : expected
> specifier-qualifier-list before 'MyUtil'
>
>
> }
> @end
>
>
> --
> W. Shao
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden