2.4 Test Node and Tree

(Win version)

< 2.3 | 2.4 | 3.0 >

It is now time to test what we have done thus far.

Compiling and running strom

In VSC19, click on the Local Windows Debugger button on the toolbar. VSC19 should rebuild your program and open it in a new console window. If there are errors reported, you will need to carefully compare the contents of the files we have created with the tutorial versions to find what is different. Note that you will not see the output that you expect in the output area of the IDE. This IDE pane shows only output related to building the executable, not the output of the program itself!

Output

The expected output of the program thus far is shown below:

Starting...
Constructing a Tree

Finished!
Destroying a Tree

The Starting... and Finished! lines are created by the main function, while the other strings are output in the Tree constructor and destructor. Note that there is no output from the Node constructor or destructor. That is because, so far, no Node objects have been created: we have created a Tree with no nodes, not even a root node!

Creating a release version

The program you just executed was the debug version of strom. The debug version runs slowly because it is not optimized. Not optimizing the program allows the IDE (VSC19) to let you run the program one line at a time and see the values of variables as the program executes. This is helpful when debugging, but ultimately we will want to create a release version that is fully optimized and as fast as possible.

To create a release version, simply change Debug to Release in the Solution Configurations dropdown of VSC19, then choose Build Solution from the Build menu (or press Control-Shift-b).

To run the release version outside of VSC19, open Windows Explorer, hold down the shift key while right-clicking the Release folder inside PROJECT_DIR, then choose Open PowerShell window here from the popup menu that appears. Type .\strom in the console window that appears. You should see the expected output when the program runs.

< 2.3 | 2.4 | 3.0 >