Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set Carbon or Cocoa Project to use C++



On Jan 20, 2006, at 11:13 AM, Jamie Gjerde wrote:

there is a "compile source as" build setting.

You should generally use this as a last resort. Instead, your source file suffixes should reflect the language used to compile that source file. If you need to build a specific file as a specific language without changing its name, you can also use the Info window for that file within Xcode to set the language it should be treated as.


the default is according to file extension but u can set it otherwise. like for cocoa, if u want to be able to include a c++ class ( defined in a .cpp file ) in an objective c or an objective c ++ file u will need to have this set to Objective-C++ for that work. if xcode is set to compile according to file extension this would not work.

This is incorrect.

If you want to use a C++ class (by including a C++ header file) in a Cocoa source file, that Cocoa source file needs to be compiled as Objective-C++ rather than Objective-C. Thus your Cocoa source file should have the ".mm" file extension.

You do not need to change the "Compile Source As" build setting in order for this to work.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Set Carbon or Cocoa Project to use C++ (From: Jamie Gjerde <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.