How can I use C++ with Objective-C in XCode
Make sure you compile that file as "Objective-C++".
The simplest way is to rename it as *.mm.
If you don't want to rename the *.m file,
- Select your file.
- Open the File Info dialog (Cmd+I)
- In File Type, select "sourcecode.cpp.objcpp"
Rename the Objective-C file from filename.m
to filename.mm
to make it compile as Objective-C++.