Making first app for iPod touch from Windows C++ application

Discussion in 'iOS Programming' started by Gennady46, Aug 3, 2012.

  1. macrumors newbie

    Aug 3, 2012
    Aug 3, 2012 1:16 AM
    Hi, finally I installed Xcode on a Mac OS. This is my first time. I am sure there are tutorials and videos out there, but I would want to be on a right direction

    without waisting any time. Basically I have made C++ application on PC under Windows 7. What it does it asks for input(s) like number(s) and makes

    calculations and outputs in a process depending on an entry. It uses for example: scanf("%s",st), cout << , cnn >> , goto Loop; uses a lot of Arrays[] and so

    on... It also uses "Enter" key on a key board to input a number.

    Now, I would like to make an app for iPod touch, like for example at the beginning image will appear, once is double clicked, it would take me to that program

    enviroment, and it will be asking for inputs and would output the same way on iPod touch window.

    Now, what type of application I have to make in Xcode? Can I just paste my original c++ code into working enviroment or I have to convert to Objective C ?

    and if so how to substitute scanf, cout, cnn, "enter" key, goto statement and so on... ??? I am sure there are Objective C tutorials out there, but initially I can

    paste my original code and compile, and go from there, so to make all necessary changes along the way, is that the way to do it?

    And also if I want to quit an app I would hit a certain button, and it would quit at any time.

    So could anyone direct me, give links, and so on...

    Thanks in advance.
  2. jamesr19, Aug 3, 2012
    Last edited by a moderator: Aug 3, 2012

    macrumors 6502

    Nov 7, 2009
    I suggest you get a book to learn the basics of iOS development and using Xcode.

    Also remember you are developing for a touch screen mobile device. User interaction should be simple. Less is more (e.g. 1 touch to do a process is far superior to having to do two touches). You should conform to design standards for iOS - it will make your app easier to use

    If you actually want to run the app on a device (and not the simulator), you have to buy a developer license. This will give you access to the forums to help. is a great website if you have any questions about how to do something. Unless your question is really niche, it will be answered in a matter of hours
  3. macrumors member

    Mar 27, 2012
    Developing Apps

    To answer your question about pasting your original code into Xcode...

    Xcode can and will compile C++, and C++ code is usable on the iPhone/iPad. However... The UIKit framework, which is used for making a user interface for an iphone app, is written completely in objective c. So displaying a picture, asking for user inputs, and displaying outputs on the screen all are done in objective c. In short, you cannot just copy and past your C++ code into Xcode and have a working app.

    Objective-c doesn't really have a specific function for displaying text on an iphone screen. You'd have to use a UILabel or something else. You can use NSLog() to print to the Xcode console though. I recommend going through a tutorial on objective c, specifically on programming with the UIKit framework. Get familiar with the UIView, and UIViewController class in particular. Once you have that down, branching out into more complicated app design will be a cinch.
  4. macrumors 604


    Nov 26, 2007
    Based on what you've described, it sounds like someone told you the classic lie that you learned C++.

    Do you know what an object is? Do you know what inheritance is? If you answer no to either of those, then you haven't learned C++. You learned C.

    The extend of what you learned that was C++ but not C was "cout", "<<", and ">>".

    goto (which you should never ever use... don't you know about functions, loops, or conditional statements? Those are always preferable to goto's...), loops, and [] arrays are all standard C.

    Other examples of C++ are Strings, Vectors, Stacks and Queues, i.e, objects.

    (I apologize if I'm a little wrong here... C++ is the language I'm weakest in so far... I'm much better with C, Obj-C, and a little better with Java.)

    That's a bit off topic now, though.

    Back on topic, I suggest glancing at this:

    You should understand the content of all of the chapters up to "18 Exercise 17: Heap And Stack Memory Allocation". Normally I say do all the exercises up until that, but since it seems you've already had some training, I'm just going to say look it all over. If there is some portion you don't understand, stop just reading and start doing the exercises.

    Once you're through with that, move onto Stanford's free iOS tutorials. They're located in iTunes. Just open it up, click on the Store on the left, then go to iTunes U. Search for Stanford. Their iOS programming course is most likely the top result, as it's by far their most popular online course.

    As far as porting your app to iOS: Don't just use the same code. Each platform has different ways that things should be done. Users expect things to be done a certain way. If you don't have a reason to stray from that certain way, then don't! Buy a device that runs the platform you'd like to port to and use it for a few weeks. Become familiar with the way things should work on it. What user interface elements do users expect to use to perform different tasks?

    Use iOS for a bit and then think about your interface. You should notice some fundamental flaws with just reusing your code... there's no command line to send/receive text from. Could you make your own? Absolutely. Should you? Absolutely not. For your application, I think the easiest way of doing it would be to have a UILabel that maybe says what should be done, a UITextField for having the user insert some text, a UIButton for telling the app that it's time to execute the code, and a UILabel into which the output gets displayed.

    You might be able to use the return key on the keyboard instead of a UIButton, but that would be a little more difficult to do (and for the user to figure out.)
  5. Gennady46, Aug 4, 2012
    Last edited: Aug 4, 2012

    thread starter macrumors newbie

    Aug 3, 2012
    thanks to all, I will try to do something you have suggested, but to start with Xcode is asking me to which type of application I should create? I saw "Carbon C++ standard Application" and "IOKIt Driver", also "Image Unit Plug-In for Objective-C" which one I should choose from the list? Or just create an "Empty" project?

Share This Page