How do I run a C++ program in Xcode 4?

96,145
  1. Launch XCode
    Step 1
  2. In the "Choose template" box, pick Mac OS X, then Command Line Tool. Press Next
    Step 2
  3. Give your project a name, select C++ as the type
    Step 3
  4. You should see a new project with main.cpp
    Step 4
  5. press the Run button
  6. At the bottom of the screen, under All Output you should see:

    Hello, World!
    Program ended with exit code: 0

Share:
96,145
Admin
Author by

Admin

Updated on January 03, 2020

Comments

  • Admin
    Admin over 4 years

    I want to write a C++ program in Xcode on my Mac. I wrote this basic one to test it. When I build, I get a "Build Successful" message.

    However, I cannot run it! If I hit Command+R nothing happens. When I go to Project->Run the Run option is disabled.

    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    
        cout << "helo" << endl;
    
    }