Create the main function

Every C++ program must define an entry point in the form of a main function.

If using Windows, create a file named main.cpp by single-clicking (to select) the project name strom in the Solution Explorer pane of VSC, then right-clicking to bring up the contextual menu, then selecting Add… > New Item…. Single-click C++ File (.cpp) and supply the name main.cpp before pressing the Add button. After the file is created, fill it with the following source code.

If using Mac, you should already have a file named main.cpp left over from when you created your Xcode project. Simply replace its current contents with those specified below.

Contents of main.cpp

#include <iostream>
#include "node.hpp"
#include "tree.hpp"

using namespace strom;

int main(int argc, const char * argv[])
    std::cout << "Starting..." << std::endl;
    Tree<Node> tree;
    std::cout << "\nFinished!" << std::endl;

    return 0;

Explanation of main.cpp

The main function firsts announces that the program is starting to run, then creates a Tree object having nodes made of Node objects, then announces that  the program is finished running just before returning 0 (the exit code 0 tells the operating system that the program ended normally).

While the program does nothing interesting at this point, it does create a Tree object and the Tree class constructor and destructor should report that they are being called, which allows a minimal test that things are working as they should.