What is Objective C++?

C++Objective CXcodeObjective C++

C++ Problem Overview


What is Objective C++ and can I use this language in Xcode?

C++ Solutions


Solution 1 - C++

Objective-C++ is simply source code that mixes Objective-C classes and C++ classes (two entirely unrelated entities). Your C++ code will work, just as before, and the resulting executable will be linked with the Objective-C runtime, so your Objective-C classes will work as well. You can definitely use it in Xcode -- name your files with the .mm extension.

Also, you might want to read [Apple's (sadly deleted, but archived) documentation on Objective-C++][1].

[1]: https://web.archive.org/web/20101203170217/http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCPlusPlus.html "The Objective-C Programming Language: Using C++ With Objective-C on Wayback Machine"

Solution 2 - C++

Objective-C++ is Objective-C (probably with Cocoa Framework) with the ability to link with C++ code (probable classes).

Yes, you can use this language in Xcode to develop for Mac OS X, iPhone/iPodTouch, iPad. It works very well.

You don't have to do anything weird in your project to use Objective-C++. Just name your Objective-C files with the extension .mm (instead of .m) and you are good to go.

It is my favorite architecture: develop base class library of my game/application in C++ so I can reuse it in other platforms (Windows, Linux) and use Cocoa just for the iPhone/iPad UI specific stuff.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSaurabhView Question on Stackoverflow
Solution 1 - C++DochesView Answer on Stackoverflow
Solution 2 - C++Pablo Santa CruzView Answer on Stackoverflow