Using Xcode after learning C++ on a PC

Discussion in 'Mac Programming' started by vvn347, Jun 27, 2010.

  1. vvn347 macrumors newbie

    Jun 27, 2010
    Hi everyone,

    I'm new to C++ programming, and have started learning the language on a compiler on a PC. However, I want to be able to use my Mac, so have set up XCode, and started fiddling around with it.

    I find that I'm not able to always use the same statments I would use on my PC in XCode. For example, I use the statement, system ("pause"); on my PC, which makes the program "freeze" the display once the program has run, so that the user can see it. In XCode, it seems that might almost not be necessary, since everything can just be viewed in the consoler. But is there something similar?

    Also, when I write code on my PC, I write it in .cpp documents, and then once compiled and run, there is an .exe file that a user can click on to run the program. What is the equivalent output file in XCode, and where can I find them?

  2. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    A few things:
    A console is a place to run a program, enter input, and view output. A consoler is one that provides consolation.

    The system function runs a program. Pause is not available, as far as I know, on OS X. cin.getch() might be more appropriate.

    Your program output from compilation will be in your project's build directory. By default it will be named the same thing as the source file containing your main function, but with no extension.

  3. BigJimSlade macrumors member

    Dec 16, 2005
    In the Products folder in the Groups & Files list, there will be an icon for your executable. Right-click on it and choose Reveal in Finder - that will open a window showing the directory it was built in.

Share This Page