Create a C++ Project

The first step is to get an integrated development environment (IDE) up and running, and which IDE you use depends on whether you are using Windows, Mac, or Linux.

Windows

I am assuming you are using Windows 10 (but these instructions may also work for other versions of Windows).

Installing Visual Studio

  1. Download and install the free Microsoft Visual Studio Community 2017 for Windows from the Visual Studio web site
  2. Under Workloads, choose Desktop development with C++, which will check Visual C++ core desktop features and several optional components. Check also the Clang/C2 (experimental) optional component
  3. Click the Individual components tab and, under Code tools, choose Git for Windows and GitHub extension for Visual Studio. Note that the installation will take a very long time!
  4. Click Install to start the installation
  5. Once it is downloaded, you will need to restart Windows
  6. After starting VSC17 (my abbreviation for Visual Studio Community 2017), you will be asked to select a default configuration: choose Visual C++ here (we will not be using any other development environment for this project)

Creating a solution with one project

  1. Start VSC17 and close the start window
  2. Use File > New > Project… to create a new Visual C++ > General > Empty Project called strom (and check Create directory for solution and Add to Source Control). I will refer to the folder where the strom project is saved as PROJECT_DIR. For me, PROJECT_DIR is simply the default: C:\Users\plewis\source\repos

Creating a header file

Important: whenever I ask you to create a new header file, use the procedure below. Right now, we are just creating files; you will fill in these files later in the tutorial.

  1. Right-click on the Header Files folder inside the strom project and choose Add > New Item…, then choose Header File (.h), set the Name field to node.hpp and press the Add button
  2. If you forgot to set the name of the header file before creating it, you can easily change the name of the default header file created from Header.h to node.hpp by right-clicking its name and choosing Rename from the popup menu

MacIntosh

I am assuming you are using MacOS 10.10.5 (Yosemite) or later; these instructions have not been tested on earlier versions.

Installing Xcode

  1. Download and install Xcode if it is not already installed on your Mac
  2. Once you install Xcode, you’ll also want to install the command line tools. To do this, go to Xcode > Open Developer Tool > More Developer Tools…, create/login using your Apple ID, then choose the latest Command Line Tools download

Creating an Xcode project

  1. Choose File > New… > Project… from the main menu
  2. Under OS X > Application, choose the Command Line Tool project template and press the Next button
  3. Under Product Name, type strom and be sure that Language equals C++, then press the Next button, choose a folder and press the Create button
  4. I will refer to the folder where the strom project was saved as PROJECT_DIR. For me, PROJECT_DIR is: /Users/plewis/Documents/software/strom

Creating a header file

In the Project Navigator pane on the left, you should now see your strom project (beside a blue icon), and inside that you should see a strom folder (beside a yellow folder icon), and inside that you should see a file named main.cpp. (If you do not see anything like this, it may be because your Project Navigator pane is not visible. You can always get it back using View > Navigators > Project Navigator from the main menu.) 

  1. Command-click the strom folder (note: click the strom folder, which currently contains main.cpp, and not the strom project) and choose New File… from the popup menu
  2. Select Header File and press the Next button
  3. Name the new file node.hpp, check the strom target, and press the Create button to save node.hpp alongside main.cpp in the strom folder
  4. You should now have a strom folder inside your strom project, and inside the strom folder you should see 2 files: node.hpp and main.cpp

You do not need to add any code to either main.cpp or node.hpp now. Right now, we are just creating files; you will fill in these files later in the tutorial.