1

I have some pure C++ codes are have I want to change the code as objective C code format. How can do this there is an any tools are there or else how can i do this.

Ben10
  • 3,221
  • 2
  • 34
  • 61

3 Answers3

5

You can compile C++ code to work on the iphone directly. Keep your core as pure C++, and write the bits that need to talk to objective-C libraries as objective-C++ ( .mm rather than .m IIRC ).

Michael Anderson
  • 70,661
  • 7
  • 134
  • 187
1

It's not possible automatically to translate C++ to Objective-C in the sense that you are asking. Picking just one of the large semantic differences at random, C++ allows multiple inheritance and Objective-C doesn't. You therefore can't map the inheritance graph of C++ onto the inheritance graph of Objective-C.

What you'd do if you were converting manually would be to switch to protocols where what you're meaning to establish is a published set of permissible communications and object composition where you wanted an object to combine some other logic. You'd probably keep the main line of inheritance in a lot of cases. However you're not going to find a tool capable of automating that process.

Tommy
  • 99,986
  • 12
  • 185
  • 204
0

You can refer following question :here

and you can compile c++ code directly by changing vc.m to vc.mm

Community
  • 1
  • 1
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79