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.
I am assuming you are using Windows 10 (but these instructions may also work for other versions of Windows).
Installing Visual Studio
- Download and install the free Microsoft Visual Studio Community 2017 for Windows from the Visual Studio web site
- 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
- 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!
- Click Install to start the installation
- Once it is downloaded, you will need to restart Windows
- 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
- Start VSC17 and close the start window
- 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.
- 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
- 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
I am assuming you are using MacOS 10.10.5 (Yosemite) or later; these instructions have not been tested on earlier versions.
- Download and install Xcode if it is not already installed on your Mac
- 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
- Choose File > New… > Project… from the main menu
- Under OS X > Application, choose the Command Line Tool project template and press the Next button
- 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
- 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.)
- 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
- Select Header File and press the Next button
- 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
- 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.