title: Identifier "buildTree" is undefined
body: <p>Have a simple error. Looked at a bunch of posts and checked the causes on my files, but couldn't seem to fix it. The functions being called from my BST.cpp file are throwing the error in the title (&quot;identifier &quot;buildTree&quot; is undefined). The functions in question are 'buildTree' and 'performSearchBST'. The CPP file is included in main and the class templates are declared on all of the functions. Probably a simple error but was hoping someone could help point it out for me. Code listed below. As always thank you in advance for your assistance.</p>
  <p>Main File:</p>
  <pre><code>
  
  //..
  #include &quot;BST.cpp&quot;
  #include &quot;Node.h&quot;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace std;
  
  int main()
  {
      //...
      ifstream filename(&quot;grocery_upc_database.csv&quot;);
      BST&lt;UPC&gt; tree = buildTree(filename); //build binary search tree of UPC objects
  
      string code;
      cout &lt;&lt; &quot;Please enter a UPC code(! to quit): &quot;;
      cin &gt;&gt; code;
      while (code != &quot;!&quot;)
      {
  
          long entry = stol(code); //convert user inputted string to type long int
          UPC key(entry);
          performSearchBST(tree, key);
  
          cout &lt;&lt; &quot;\nPlease enter a UPC code(! to quit): &quot;;
          cin &gt;&gt; code;
      }
  
      return 0;
  }
  
  </code></pre>
  <p>BST.cpp</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &quot;BST.h&quot;
  
  
  using namespace std;
  
  template &lt;class T&gt;
  BST&lt;T&gt;::BST()
  {
      root = NULL;
  }
  template &lt;class T&gt;
  BST&lt;T&gt;::BST(long upcdata, string descrip)
  {
      root-&gt;data = upcdata;
      root-&gt;descrip = descrip;
  }
  template &lt;class T&gt;
  void BST&lt;T&gt;::buildTree(string inFile)
  {
      string upcholder;
      string description;
      string line;
      ifstream file;
      file.open(&quot;grocery_upc_database.csv&quot;);
      while (getline(file, line))
      {
          stringstream ss(line);
          getline(ss, upcholder, ',');
          getline(ss, description, '\t');
          Node&lt;T&gt; newNode;
          newNode-&gt;data = stol(upcholder);
          newNode-&gt;descrip == description;
          insert(newNode);
      }
  }
  
  template &lt;class T&gt;
  void BST&lt;T&gt;::insert(Node&lt;T&gt; *newNode)
  {
      insert2(root, newNode);
  }
  
  template &lt;class T&gt;
  void insert2(Node&lt;T&gt; *&amp;root, Node&lt;T&gt; *newNode)
  {
      if (root-&gt;data = NULL)
      {
          root = newNode;
      }
      else if (newNode-&gt;data &lt; root-&gt;data)
      {
          insert2(root-&gt;left, newNode);
      }
      else
      {
          insert(root-&gt;right, newNode);
      }
  }
  
  template &lt;class T&gt;
  long BST&lt;T&gt;::stol(string item)
  {
      long i = atol(item.c_str());
      return i;
  }
  
  template &lt;class T&gt;
  bool BST&lt;T&gt;::performSearchBST(BST&lt;T&gt; bst, UPC key)
  {
      return performSearchBST2(bst,key);
  }
  template &lt;class T&gt;
  bool performSearchBST2(BST&lt;T&gt; bst, UPC key)
  {
      if (bst.root == NULL)
          return false;
      
      if (bst.root-&gt;data == key)
          return true;
      else if (root-&gt;data &lt; key)
          return performSearchBST2(root-&gt;right, key);
      
      else
          return performSearchBST2(root-&gt;left, key);
      
      
  }
  </code></pre>
  <p>BST.h</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &quot;Node.h&quot;
  
  using namespace std;
  
  template &lt;class T&gt;
  class BST
  {
      Node&lt;T&gt; *root;
  
  public:
      BST();
      BST(long key, string descrip);
      bool find(T item);
      bool performSearchBST(BST&lt;T&gt; bst, UPC key);
      void buildTree(string inFile);
      void insert(Node&lt;T&gt;* newNode);
      long stol(string item);
  };
  </code></pre>