How to run a C++ program in XCode in Mac

How to run a C++ program in XCode:

If you are using a Mac then you can use XCode to run a C++ program. In this post, we will learn how to use XCode to run a C++ program.

Steps to run a C++ program in XCode:

Follow the steps below to run a C++ program in XCode:

  1. You need to download XCode if it is not installed. Go to the App Store and download XCode to install it. Open XCode after the installation is done and install other command line tools if it prompts.
  2. Once done, open XCode.
  3. Click on Create a new XCode project:

XCode create project

  1. Select Command line Tool from the project selection menu. Make sure to select macos on top.

XCode select project selection menu

  1. Give a Product Name, Select the Team and check the language as C++. Click on Next and save the project in a folder.

  2. It will create a main.cpp file with some default code. Click on the play button and it will execute that code and print the data on console below.

XCode run program

That’s it.

You might also like: