•
If this is a C project, set all of these to No to avoid some confusing name conflicts.
Here, "module" is mac-ese for this automatic mechanism, and is related to, but different
from, how "module" is used in this course. (There has been a defect in the C project
template, probably a spill-over from the Objective-C project template) that causes some
macOS application headers to be automatically included, and libraries automatically
added to the build, which can cause name conflicts.) The problem does nor arise if the
C++ Language was selected.
Apple Clang Warning Policies:
•
Pedantic warnings - yes.
Apple Clang Warnings:
•
For C projects especially, Missing Function Prototypes - yes
•
The defaults are pretty good, but you can turn on other warnings as you wish; I suggest
the following: Check switch statements, mismatched return type, missing braces,
missing newline at end of file, sign comparison, unused variables.
5. The "create a new project" will normally produce a "hello world" project main function file.
You can do a build and a run to check whether everything seems to work. Then select and delete
the hello world files.
6. Then start adding your own files to the project. To create a new file, choose File/New/File …
which will open a template chooser in which you can select a header file, a C file, or a C++ file.
If you select a C or C++ file, it will give you the option of also creating a header file with the
same name. The new files will be added to the project, ready for you to start editing.
However, be sure to correct Apple’s dubious choice of contents for the header file (the project file
templates apparently weren't prepared by mainstream C/C++ programmers!). Also change the
extension of a C++ header file from .hpp (preferred by some people) to .h (preferred by many C+
+ wizards, and used in this course throughout). Correct the include guard symbol — it violates
the coding standards for the course. Also delete their misguided #include of <stdio.h>, or
<iostream> which should almost never be in a header file (See C++ Header File Guidelines
handout). Including these in a new header by default is misguided.
If you already have the files, drag them into the project folder into the folder where the source
files go (confusingly, with the same name as the project), and then select File/Add files to project
and select the files to be added to the project.
To remove a file from the project, select it in the sidebar window and hit delete; you can choose
whether to keep the file but remove the reference to the file from the project, or to trash it.
Normally you only want to remove the reference because this is an easy way to change the top-
level module of a project for testing purposes.
I find it useful to keep the file structure on disk parallel to the structure shown in the project
sidebar window. Keeping all the sources in a single directory by themselves makes it easier to
upload to my CAEN account later.