To compile and run the example code on Mac OS X follow the instructions below. You will first need to install XCode which is available from http://developer.apple.com/technology/xcode.html.
Now follow the instructions below
main.cpp
. You can see this file in the tree on the left hand side. Click this file and on the right hand side
of the screen you will see a text editor window where you can edit the code for main.cpp
.
Setting up your first-ever project is probably the most fiddly and tedious task you will have to perform when learning C++.
Why are there so many steps to creating your project?
Firstly a typical C++ project contains a lot of different files, so in practice you don't normally run through such a complex process very often. Most of the steps above are only needed when you create a new project. The only step you would be likely to perform repeatedly is: Pressing CMD+R to compile and run your program.The project groups together all of your files and allows you to set in one place the configuration options for all your files. This is why it makes sense to have a ``project'' as well as just the C++ files.
Secondly, you can write different types of programs. Most programs have windowed user interfaces, but very old fashioned programs have text input through the ``console''. Console programs are easier to write, but not the default on Mac OS X. So we have to tell XCode that is the kind of program we want.
As you can see, when configuring your project there are a wealth of options available to tune how your C++ program runs. The projects you can download from the website for C++ for Financial Mathematics all have three additional properties set. These are necessary to ensure that there are no warnings when you compile the code. In the section Custom Compiler Flags of the Build Settings, we have added the "Other Warnings Flags" ~-Wno-inconsistent-missing-override~ and ~-Wno-unreachable-code~. Under Warnings - All Langauges, we have set the "Implicit conversion to 32 bit type" setting under to No. Without these flags you will receive some compilation warnings about relatively trivial issues that are easily fixed. Fortunately, when you download the projects from this website all these configuration settings will be set correctly already.