I am very good at C/C++ but can't get the Obj C syntax. Is there an app where I can type the complete source code of my app in C/C++ and when I click "Convert", it automatically converts the source code to Obj. C. ?
This would be very helpful...![]()
I am very good at C/C++ but can't get the Obj C syntax. Is there an app where I can type the complete source code of my app in C/C++ and when I click "Convert", it automatically converts the source code to Obj. C. ?
This would be very helpful...![]()
My iPhone
iPhone 4 (32 GB) Black, Firmware 4.1
My Mac mini
2.0 GHz Dual core, 2GB RAM, 160 GB HDD, Leopard 10.5.8
My MacBook
2.0 GHz Dual core, 4 GB RAM, 160 GB HDD, SnowLeopard 10.6.4
My Blogs:
Jash's Blog: http://www.jashsayani.com
The iFone Blog: http://theifoneblog.blogspot.com
You can mix C or C++ code with Objective C
My iPhone
iPhone 4 (32 GB) Black, Firmware 4.1
My Mac mini
2.0 GHz Dual core, 2GB RAM, 160 GB HDD, Leopard 10.5.8
My MacBook
2.0 GHz Dual core, 4 GB RAM, 160 GB HDD, SnowLeopard 10.6.4
My Blogs:
Jash's Blog: http://www.jashsayani.com
The iFone Blog: http://theifoneblog.blogspot.com
If you look at the source code of nes.app from NerveGas here (http://www.zdziarski.com/projects/nesapp/). You can see there are C code source files.
However, iPhone has no command line interface in the UIKit, so you have to mix C code with Objective C code (for UIKit API).
As you probably aware that every iPhone app has a
int main(int argc, char *argv[])
and that is C syntax.
Objective C is a hybrid of C syntax and Smalltalk. And later it adds C++ syntax to it so now you can mix C / C++ code with Objective C.
If you build command line utility, you can use printf. But it is only for jailbroken iPhone.
P.S.
If you mix C++ code and Objective C, the source file name should end with .mm
If you use C++ syntax only in the source code, the filename should end with .cpp
Last edited by javacom; 06-16-2008 at 03:19 PM.
My iPhone
iPhone 4 (32 GB) Black, Firmware 4.1
My Mac mini
2.0 GHz Dual core, 2GB RAM, 160 GB HDD, Leopard 10.5.8
My MacBook
2.0 GHz Dual core, 4 GB RAM, 160 GB HDD, SnowLeopard 10.6.4
My Blogs:
Jash's Blog: http://www.jashsayani.com
The iFone Blog: http://theifoneblog.blogspot.com
You must use objective C for the UIKit API because there is no bridge for UIKit API (official SDK) to other languages.
But you can use C++ classes and mix them with Objective C. It is called Objective C++ in Objective C language.
Last edited by javacom; 06-18-2008 at 05:10 AM.
My iPhone
iPhone 4 (32 GB) Black, Firmware 4.1
My Mac mini
2.0 GHz Dual core, 2GB RAM, 160 GB HDD, Leopard 10.5.8
My MacBook
2.0 GHz Dual core, 4 GB RAM, 160 GB HDD, SnowLeopard 10.6.4
My Blogs:
Jash's Blog: http://www.jashsayani.com
The iFone Blog: http://theifoneblog.blogspot.com
Bookmarks