Results 1 to 7 of 7
Discuss [Advice] C to Obj C - Syntax Converter ? at the iPhone Developer Exchange - Hackint0sh.org; I am very good at C/C++ but can't get the Obj C syntax. Is there ...
  1. #1
    Amazingly Knowledgeable Array jashsayani's Avatar

    Join Date
    Dec 2007
    Location
    Salt Lake City, UT
    Posts
    958
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    55

    Default [Advice] C to Obj C - Syntax Converter ?

    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



  2. #2
    Developer Array javacom's Avatar

    Join Date
    Mar 2008
    Posts
    304
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    28

    Default

    You can mix C or C++ code with Objective C

  3. #3
    Amazingly Knowledgeable Array jashsayani's Avatar

    Join Date
    Dec 2007
    Location
    Salt Lake City, UT
    Posts
    958
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    55

    Default

    Quote Originally Posted by javacom View Post
    You can mix C or C++ code with Objective C
    Do you mean that the syntax for Obj C is a mixture of syntax of C and C++ ?
    Well, then what about taking inputs from user and displaying outputs..

    In C, we use: scanf and printf
    And In C++, we use cin>> and cout<<

    Now how is the syntax of Obj C. related to this...
    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

  4. #4
    Developer Array javacom's Avatar

    Join Date
    Mar 2008
    Posts
    304
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    28

    Default

    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.

  5. #5
    Amazingly Knowledgeable Array jashsayani's Avatar

    Join Date
    Dec 2007
    Location
    Salt Lake City, UT
    Posts
    958
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    55

    Default

    Quote Originally Posted by javacom View Post
    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
    Oh! ok. Thanks for the explanation.

    So, Can I make apps with C++ on the iPhone SDK ?
    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


  6. #6
    Developer Array javacom's Avatar

    Join Date
    Mar 2008
    Posts
    304
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    28

    Default

    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.

  7. #7
    Amazingly Knowledgeable Array jashsayani's Avatar

    Join Date
    Dec 2007
    Location
    Salt Lake City, UT
    Posts
    958
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    55

    Default

    Quote Originally Posted by javacom View Post
    You must use objective C for the UIKit API because there is no bridge for UIKit API to other languages.
    But you can use C++ classes and mix them with Objective C. It is called Objective C++ in Objective C language.
    Oh ok. Thanks for explaining..
    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

 

 

Similar Threads

  1. Replies: 0
    Last Post: 07-12-2011, 07:50 AM
  2. Replies: 3
    Last Post: 04-16-2008, 10:32 AM
  3. [Advice] free video converter ?
    By likes in forum Tools
    Replies: 12
    Last Post: 01-13-2008, 11:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 12:04 PM.
twitter, follow us!