How to compile specific files in objective-c++ and the rest of the project in objective-c How to compile specific files in objective-c++ and the rest of the project in objective-c xcode xcode

How to compile specific files in objective-c++ and the rest of the project in objective-c


Select the file you want to compile as Objective C++ from the file navigator, and then select the File Type in the file inspector view. This is in Xcode 4, but there is a similar mechanism in Xcode 3.

Selecting File Type from the file inspector


Try renaming the files where you are including the library headers to myClass.h for interface and myClass.mm for implementation files. This forces the files to be compiled as objective-c++.


I have resolved this problem:

  1. You should set "According to file type" to "Complile Sources As",
  2. Set "-ObjC++" to the "Other Linker Flags"
  3. The last,you should modify the files's suffix to .mm that referencethe library method