How to Compile .cpp and cocoa classes together - debenbraveheart/Mac-OSX---Cocoa-quartz GitHub Wiki
change the .m file to .mm
Than create the cpp file [let us name it as x.cpp]
Then go to project setting and then Build Phases.
->Compile Sources
select the file (.cpp) and add -x objective-c++ in the Compiler flags option