Pitt | Swanson Engineering
helloXcode4

Making Your First Project (Hello World!)

1. Open Xcode & Create New Project

  step1
 

Version numbers may vary.
Recent projects will appear on the right-hand side.

2a. Select "Command Line Tool"

 
  step2a  

First, on the left, select Application.
Then, select the "Command Line Tool".

2b. Name Project and Choose Type

  step2b
 

Give the project a name.
Finally select the type of program, "C".
Notice: Selecting "C" will break the use of cin / cout .
You can safely set this to "C++" to write any program in this course, though you may need to change what Xcode provides as the template "Hello World!".
After this window, select a folder in which to save the project.
You can ignore the Git source control repository checkmark.

3. Write Some Code ...

  step3
 

This is the general Xcode Window, with three items in the project:
Don't panic: Single click the source file (ends in .c or .cpp )
You should see the code window after that.
Double clicking the source file pops it into an external window for more room.
You should immediately rename the source file, especially before you submit it in the drop box!
To rename, single click the name of the source file (defaults to main.cpp ). Just make sure the new name also ends in .c or .cpp  

Click the "Run" button to compile and run your code.
Use the "Stop" button if you want to halt your running code (stuck in loop, etc).

4. ... And Run It!

  step4
 

The console appears at the bottom of the window.
You can safely ignore everything before [Switching to process ###]
Alternatively, change the type of output you see to "Target Output".
You can type into this window if your program requires keyboard input.
The View widget at the top of the window toggles what you see.
Also, there's a widget for the bottom bar to increase the output window.
Drag dividers to change how much space each bar gets.