• 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: Mixing C++ and Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing C++ and Objective-C


  • Subject: Re: Mixing C++ and Objective-C
  • From: Peter N Lewis <email@hidden>
  • Date: Mon, 9 Feb 2009 10:42:56 +0900

At 12:29 -0800 7/2/09, Steve Wart wrote:

It works fine in 10.5.6 with XCode 3.1 if I change the file type of
BasicOpenGLView.m to sourcecode.cpp.objcpp.

You normally use the extension .mm for Objective C++ code.

At 10:41 +0900 9/2/09, Peter N Lewis wrote:
At 13:12 -0800 7/2/09, Steve Wart wrote:
Solved, thanks to the archives.

#ifdef __cplusplus
extern "C" {
#endif

Personally, I just switch the whole project to compile everything in Objective C++ and this eliminates the need for ifdef __cplusplus at essentially no cost in compile time, execution speed or executable size. It just means you are only dealing with one version of C to go with your Objective C rather than C, C++ and Objective C.


Enjoy,
   Peter.

--
              Keyboard Maestro 3 Now Available!
   Now run macros from your iPhone with Keyboard Maestro Control!

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.com/>
_______________________________________________

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: Mixing C++ and Objective-C
      • From: "Sean McBride" <email@hidden>
References: 
 >Mixing C++ and Objective-C (From: Steve Wart <email@hidden>)

  • Prev by Date: Re: passing argument 1 of 'setContents:' from incompatible pointer type
  • Next by Date: How do I unit test an object delegate?
  • Previous by thread: Re: Mixing C++ and Objective-C
  • Next by thread: Re: Mixing C++ and Objective-C
  • Index(es):
    • Date
    • Thread