Pitt | Swanson Engineering

Making Your First Project (Hello World!)

1. Open Xcode & Create New Project




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


2. Select "Command Line Tool"




First, on the left, select Application.
Then, select the "Command Line Tool".
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!".


3. Write Some Code ...




This is the general Xcode Window, with three items in the project:


  1. An executable (icon looks like a black box)
  2. Documentation file (filename ends in .1 - can be safely ignored)
  3. Source file (ends in .c or .cpp )
    You should immediately rename this, especially before you submit it in the drop box!
    Just make sure the new name also ends in .c or .cpp  


You can hide the left-hand pane by double clicking the circle on the vertical bar.
For more room, feel free to drag the horizontal bar up.
For the most room, double click the source file in the file list.
This will create a new window with just your code.


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


4. ... And Run It!




This is what the console looks like.
You can safely ignore everything before [Switching to process ###]
You can type into this window if your program requires keyboard input.
You may need to "Clear Log" if you want to erase some output from previous runs.