This document was written for XCode 12.5.1 on macOS 11.5.1 Big Sur.
Create a new project from the XCode splash screen or by selecting
New > Project... from the File menu
Select macOS at the top of the panel
Under Application, select Command Line Tool and click Next
Specify the name for the project (e.g. “Hello World Project”) and make
sure that language is set to “C”
The project starts with an empty file named “main.c”. You may use this file
or delete it and add others.
To change the compiler settings for the project (REQUIRED FOR CSC173):
Select the project
Select the “Build Settings” tab
Scroll down to “Apple Clang - Language”
For “C Language Dialect” select “C99 [-std=c99]”
Under “Apple Clang - Warning Policies”
For “Treat Warnings as Errors” select Yes
Do one of the following to turn on all errors:
Under “Apple Clang - Warnings - All languages”
Make sure that all entries are set to YES
Under “Apple Clang - Custom Compiler Flags” (scroll up to find this)
For “Other Warning Flags” enter: -Wall
By default, XCode builds an executable whose name is the same as the name
of the project. That's fine if your project is named “project1” or
something like that, but not so good if it's longer, has spaces, etc.
To rename the executable built for the project (optional but recommended):
Select the project in the Project navigator (left pane)
Select the (only) target for the project in the left of the middle pane
Under “Packaging” replace the default “$(TARGET_NAME)” with whatever
you want the executable to be called (e.g., “hello”);
To find the executable file built by XCode:
Select it under “Products” in the Project navigator