How to write Language C or C++ Program on Macintosh OSX using Xcode

I assume that you are on latest Mac with Xocde 5 or later already installed on your mac from Mac App Store.

 
SO here is how to write Language C or C++ Program Code on Macintosh OSX using Xcode.

 

Note: Writing a C or C++ specific code only differs on Step 05 every other step is the same.

 
01-Xcode

 
Step 01 is to Navigate to ‘Application’ folder & double click on ‘Xcode’ Application

 
OR Click on ‘Spotlight’ at top left menu bar of your Mac & type ‘Xcode’ press return key on keyboard after getting appropriate search results

 
02-Xcode-Welcome-Screen-Create-New-Project

 
Step 02 is to select ‘Create New Project’ & click over it or go to File menu > New > Project while Xcode is selected & running

 
03-Choose-New-Xcode-Project-Template-Sheet

 
Step 03 You will get Choose Xcode Project Template Dialog box UI

 
Under OSX on the left side choose ‘Application’ then select ‘Command Line tool’ on right & then click on Next button

 
04-Choose-New-Xcode-Project-Options

 
On Step 04 you will be given to input Product Name, Organisation Name, Company Identifier.

 
You can choose any name desired for your Product name i.e. Application Name

 
For Organisation Name choose any desired or your organisation name.

 
for Company Identifier you shoul write your organisation’s website URL in reverse order as development etiquette e.g com.your-organisation-website-name.app-name

 
05-Choose-Project-or-Language-Type

 
Step 05

 
Under same screen & dialogue box as Step 04 you will have to choose your Project type. So for Language C Project choose C under Type drop down menu & for C++ Project choose C++.

 
06-Svae-Xcode-Project-to-Destination-in-Finder

 
Step 06

 
Now you will get Save Project Dialog box, Click on ‘Desktop’ on left, now click on Create new Folder button at bottom choose that folder & Click on ‘Create’

 
Note: You can uncheck or check ‘Create git repository on My Mac’ as you desire that is not important as of now.

 
07-Xcode-Project-Settings-Page

 
Step 07: Now you will presented with Project Settings Page

 
08-Choose-main-c-write-code

 
Step 08: Select appropriate ‘main.c’ (If you have chosen Language C in Step 05) or ‘main.cpp’ (If you have chosen Language C++ in Step 05) at sidebar & you are good to go to start writing your code

 
Hope this help you to get going to start coding…

 
Thanks & Regards
Mandar Apte

Leave a Reply

Your email address will not be published. Required fields are marked *