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

how to include pure C++ header in obj-C in Xcode


  • Subject: how to include pure C++ header in obj-C in Xcode
  • From: Wayne Shao <email@hidden>
  • Date: Mon, 9 Aug 2010 23:01:13 -0700

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

  • Follow-Ups:
    • Re: how to include pure C++ header in obj-C in Xcode
      • From: Velocityboy <email@hidden>
  • Prev by Date: Re: help with linking combo boxes
  • Next by Date: Re: how to include pure C++ header in obj-C in Xcode
  • Previous by thread: Re: Custom zones...
  • Next by thread: Re: how to include pure C++ header in obj-C in Xcode
  • Index(es):
    • Date
    • Thread