I'm following a tutorial on creating a binary tree but when I go to compile I get the following error. Error 1 fatal error C1083: Cannot open include file: 'IntBinaryTree': No such file or directory. I've looked up various ways to fix it but nothing have proven to help. Here is the code, help would be highly appreciated.
// btree.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <IntBinaryTree.h>
using namespace std;
struct TreeNode
{
int value;
TreeNode *left;
TreeNode *right;
void IntBinaryTree::insertNode(int num)
{
TreeNode *newNode, // Pointer to a new node
*nodePtr; // Pointer to traverse the tree
// Create a new node
newNode = new TreeNode;
newNode->value = num;
newNode->left = newNode->right = NULL;
if (!root) // Is the tree empty?
root = newNode;
else
{
nodePtr = root;
while (nodePtr != NULL)
{
if (num < nodePtr->value)
{
if (nodePtr->left)
nodePtr = nodePtr->left;
else
{
nodePtr->left = newNode;
break;
}
}
else if (num > nodePtr->value)
{
if (nodePtr->right)
nodePtr = nodePtr->right;
else
{
nodePtr->right = newNode;
break;
}
}
else
{
cout << "Duplicate value found in tree.\n";
break;
}
}
}
}