Question

I have been given some C++ classes to incorporate into my Objective C project. I've never done this before, so I have to ask:

  1. Is there something special I need to do or can I just rename the .cpp to .mm?
  2. What about importing (or including) the .h file? Anything special I need to do there?

Just baby steps here. Thank you.

Was it helpful?

Solution

Remember how the C build model works; It is the Objective-C files including C++ headers that must be switched over to Objective-C++.

OTHER TIPS

See my answer to this question. Basically, the .mm convention is a nicety, not a necessity. If you use the File Inspector to set up the file types of the .h\.m\.cpp files correctly, you can get Objective-C to play nicely with C++ files without difficulty.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top