• 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: how to include pure C++ header in obj-C in Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >how to include pure C++ header in obj-C in Xcode (From: Wayne Shao <email@hidden>)

  • Prev by Date: how to include pure C++ header in obj-C in Xcode
  • Next by Date: Re: UIPinchGestureRecognizer and MPMovieController view
  • Previous by thread: how to include pure C++ header in obj-C in Xcode
  • Next by thread: Re: UIPinchGestureRecognizer and MPMovieController view
  • Index(es):
    • Date
    • Thread