Help With Xcode

Discussion in 'iPhone/iPad Programming' started by Decriptic, Nov 23, 2009.

  1. macrumors newbie

    Joined:
    Nov 23, 2009
    #1
    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. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    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. macrumors newbie

    tutukun

    Joined:
    Nov 19, 2009
    #3
    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++
    http://consultingblogs.emc.com/filthyria/archive/2008/09/03/using-c-with-objective-c-and-iphone-sdk.aspx


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

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #4
    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. thread starter macrumors newbie

    Joined:
    Nov 23, 2009
    #5
    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. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #6
    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. macrumors 6502

    fernandovalente

    Joined:
    Aug 29, 2008
    Location:
    Third world **** hole, I mean, Brazil
    #7
    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