title: error defining operator == and operator > using binary search tree
body: <p>i am working on a program that reads in a text file that the user inputs, creates a text file that the user inputs, names the text file that the user wants, and then sorts the text file sorting words above the user entered in threshold and displays the words and how many times it was found to the output file the user specify's. i have most of the code finished but im getting a compiler error heres the sample output, error and code</p>
  
  <p>sample output</p>
  
  <p>Enter name of input command file; press return.
  history.in
  Enter name of output file; press return.
  history.out
  Enter name of test run; press return.
  sample
  Enter the minimum size word to be considered.
  5
  Sample results (found in user specified output file):
  sample
  abacus 4
  abstract 1
  adding 1
  addition 2
  advances 1
  after 3</p>
  
  <p>where the word is the word found in the text file, and the number next to it is how many times it was found.</p>
  
  <p>The compiler errors are:</p>
  
  <pre><code>C:\Users\kevin jack\Desktop\prog-4&gt;g++ -o try main.cpp
  main.cpp:(.text+0x329) undefined reference to `StrType::PrintToFile(bool, std::basic_ofstream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'
  :main.cpp:(.text+0x608): undefined reference to `StrType::GetStringFile(bool, InType, std::basic_ifstream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'
  main.cpp:(.text+0x639): undefined reference to `StrType::LenghtIs()'
  main.cpp:(.text+0x6d8): undefined reference to `StrType::GetStringFile(bool, InType, std::basic_ifstream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;)'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>i have no idea what this means if anyone knows please inform me here is my code</p>
  
  <p>main.cpp</p>
  
  <pre><code>//main.cpp
  #include &lt;fstream&gt;
  #include "StrType.h"
  #include &lt;cstddef&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  struct WordType
  {
         public:
                StrType word;       
                int count;
  
  
  };
  
  
  struct TreeNode
  {
         WordType info;
         TreeNode* left;
         TreeNode* right;
  
  };
  
  class ListType
  {
        public:
               ListType();
               void InsertOrIncrement (StrType string);
               void Print(std::ofstream&amp;) const;
        private:
                TreeNode* root;
  };
  
  
  ListType::ListType()
  {
       root=NULL;
  }
  
  void Process(TreeNode*&amp; tree, StrType s)
  {
  
       if(tree == NULL)
       {
           tree = new TreeNode;
           tree-&gt;info.word = s;
           tree-&gt;info.count = 1;
           tree-&gt;left = NULL;
           tree-&gt;right = NULL;
       }
  
       else if (tree-&gt;info.word == s)
           tree-&gt;info.count++;
       else if (s &lt; tree-&gt;info.word)
           Process(tree-&gt;left, s);
       else 
           Process(tree-&gt;right, s);
  }
  
  void ListType::InsertOrIncrement(StrType s)
  {
       Process(root, s);
  }
  
  void Print (TreeNode* tree, std::ofstream&amp; outFile)
   {
  
        if (tree!= NULL)
        {
            Print(tree-&gt;left, outFile);
            tree-&gt;info.word.PrintToFile(true, outFile);
            outFile &lt;&lt;" "&lt;&lt; tree-&gt;info.count;
            Print(tree-&gt;right, outFile);
        }
   }
  
   void ListType::Print(std::ofstream&amp; outFile) const
   {
        ::Print(root, outFile);
   }
  
  
  int main()
  {
      using namespace std;
      ListType list;
      string inFileName;
      string outFileName;
      string outputLabel;
      ifstream inFile;
      ofstream outFile;
      StrType string;
      int minimumLenght;
  
      cout&lt;&lt;"enter in imput file name."&lt;&lt;endl;
      cin&gt;&gt;inFileName;
      inFile.open(inFileName.c_str());
  
      cout&lt;&lt;"enter name of output file."&lt;&lt;endl;
      cin&gt;&gt;outFileName;
      outFile.open(outFileName.c_str());
  
      cout&lt;&lt;"enter name of test run."&lt;&lt;endl;
      cin&gt;&gt;outputLabel;
      outFile&lt;&lt; outputLabel &lt;&lt; endl;
  
      cout&lt;&lt;"enter the min word size."&lt;&lt;endl;
      cin&gt;&gt;minimumLenght;
  
      string.GetStringFile(true, ALPHA_NUM, inFile);
      while(inFile)
      {
  
           if(string.LenghtIs() &gt;= minimumLenght)
              list.InsertOrIncrement(string);
           string.GetStringFile(true, ALPHA_NUM, inFile);
      }
  
      list.Print(outFile);
      outFile.close();
      inFile.close();
      return 0;
  }
  </code></pre>
  
  <p>StrType.h</p>
  
  <pre><code>//StrType.h
  #include &lt;fstream&gt;
  #include &lt;iostream&gt;
  
  const int MAX_CHARS=100;
  enum InType{ALPHA_NUM, ALPHA, NON_WHITE, NOT_NEW};
  
  class StrType
  {
        public:
               void MakeEmpty();
              void GetString(bool skip, InType charsAllowed);
               void GetStringFile(bool skip, InType charsAllowed,
                  std::ifstream&amp; inFile);
               void PrintToScreen(bool newLine);
               void PrintToFile(bool newLine, std::ofstream&amp; outFile);
               int LenghtIs();
               void CopyString(StrType&amp; newString);
                bool operator==(const StrType&amp; other) const;  
                bool operator&lt;(const StrType&amp; other) const;
  
  
  
  
        private:
                char letters[MAX_CHARS + 1];
  
  };
  bool StrType::operator==(const StrType&amp; other) const  
  {  
      return (strcmp(letters, other.letters) == 0);  
  }  
  
  bool StrType::operator&lt;(const StrType&amp; other) const  
  {  
      return (strcmp(letters, other.letters) &lt; 0);  
  }  
  
  void StrType::MakeEmpty()
  {
       letters[0] ='\0';
  }
  </code></pre>
  
  <p>what i was trying to overload the == and > operator. i am stating it in class StrType and defining it just below it but im not sure if im defining it correctly or even in the right spot! any help would be greatly appreciated</p>