Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Decriptic

macrumors newbie
Original poster
Nov 23, 2009
3
0
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?
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
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.
 

tutukun

macrumors newbie
Nov 19, 2009
9
0
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?

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++
 

firewood

macrumors G3
Jul 29, 2003
8,106
1,343
Silicon Valley
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.

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.
 

Decriptic

macrumors newbie
Original poster
Nov 23, 2009
3
0
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?
 

firewood

macrumors G3
Jul 29, 2003
8,106
1,343
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!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.