Help With Xcode

Discussion in 'iOS Programming' started by Decriptic, Nov 23, 2009.

  1. Decriptic macrumors newbie

    Nov 23, 2009
    I want to know if it is possible to make iPhone applications in C++ in Xcode. I know a few programming languages, but Objective-C is quite complicated. This is probably because I have started out with C++. So that is why I need to know if Xcode is capable of making C++ iPhone apps. Any help?

    And if so can you tell me how?
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Learn Objective-C. You'll be much better off. Sticking with one language because that's what you already know is only going to hurt you in the long run.
  3. tutukun macrumors newbie


    Nov 19, 2009
    you only need Obj-C to communicate with some part of the Iphone sdk. The actual code for your app can still be in C++

    best example would a oolong game engine oolongengine
    Its mostly written in C++
  4. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    Objective-C is much less complicated than C++. Look at the size of the latest C++ specification.

    The obvious difference to get over quickly is that the punctuation abuse being different.

    And you can write most of an app in C++ except for the UI, since gcc is the compiler.
  5. Decriptic thread starter macrumors newbie

    Nov 23, 2009
    Thank you all, so all in all, the User Interface will have to be coded in Objective-C? And its not possible to change that?
  6. firewood macrumors 604

    Jul 29, 2003
    Silicon Valley
    There is no documented (and thus allowed) API for the UI (including windows, touch input and other events, etc.) except those in Objective C.

    But any experienced programmer who isn't sharp enough to pick up the basics of Objective C in a few weeks probably isn't sharp enough to write a decent iPhone app anyway.

    I suppose if you really wanted to be demented, you might be able to do it using very complicated plain C. An Objective C compiler could be written to output plain C plus a support runtime (the first Objective C compiler was reportedly implemented this way). So you could write C macros in the form of post-processed Objective C compiler output, and have those C macros call Apple's Objective C runtime/interpreter using introspection, etc. It might be up to 10X the lines of code and 1/10th as readable, and you would need to be an expert in the Objective C language and runtime to pull this off...

    So, yes, it's possible. Have Fun!
  7. fernandovalente macrumors 6502


    Aug 29, 2008
    Third world **** hole, I mean, Brazil
    Yes you can, but you will need Objective-C for things such as recognizing touchs and accelerometer. You will need to do some research about Objective-C++.

Share This Page