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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/velocityboy%40rodentia.net
> 
> This email sent to velocity...@rodentia.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to