Solutions Log

October 5th 2009

C++ in Objective-C


How do I compile C++ code in Objective-C / Cocoa.


Rename the Objective-C implementation file from *.m to *.mm

This tells the Objective-C compiler that it is linking a C++ object

Hearsay (Untested)

You cannot instantiate a C++ class directly because the constructor and destructor will not fire. Instead, you want to create a pointer and use the new and delete methods