title: Redefinition of ..., previously declared here
body: <p>I know there are plenty of questions like these, but I couldn't find a solution that worked for me. Anyways, I have 4 files, two header files and two cpp files, one implementation and one main.</p>
  
  <p><strong>Header File 1</strong></p>
  
  <pre><code>#ifndef SORTEDINTERFACE_H
  #define SORTEDINTERFACE_H
  using namespace std;
  
  template&lt;class ListItemType&gt;
  class sortedInterface
  {
  public:
      virtual int sortedGetLength() const = 0;
      virtual bool sortedIsEmpty() const = 0;
      virtual bool sortedInsert(const ListItemType&amp; newItem) = 0;
      virtual bool sortedRemove(const ListItemType&amp; anItem) = 0;
      virtual bool sortedRetrieve(const ListItemType&amp; anItem) = 0;
      virtual int getItemCount () = 0;
  
  private:
      virtual int locatePosition(const ListItemType&amp; anItem) = 0;
  };
  #endif // SORTEDINTERFACE_H_INCLUDED
  </code></pre>
  
  <p><strong>Header File 2</strong></p>
  
  <pre><code>#ifndef SORTED_H
  #define SORTED_H
  #include "sortedInterface.h"
  using namespace std;
  
  template&lt;class ListItemType&gt;
  class sorted : public sortedInterface&lt;ListItemType&gt;
  {
  public:
      sorted();
      int sortedGetLength() const;
      bool sortedIsEmpty() const;
      bool sortedInsert(const ListItemType&amp; newItem);
      bool sortedRemove(const ListItemType&amp; anItem);
      bool sortedRetrieve(const ListItemType&amp; anItem);
      int getItemCount();
  
  private:
      static const int DEFAULT_LIST_SIZE = 10;
      ListItemType items[DEFAULT_LIST_SIZE];
      int itemCount;
      int maxItems;
      int locatePosition(const ListItemType&amp; anItem);
  };
  #include "sorted.cpp"
  #endif // SORTED_H
  </code></pre>
  
  <p><strong>CPP File</strong></p>
  
  <pre><code>#include "sorted.h"
  #include &lt;cstddef&gt;
  using namespace std;
  
  template&lt;class ListItemType&gt;
  sorted&lt;ListItemType&gt;::sorted() : itemCount(0), maxItems(DEFAULT_LIST_SIZE)
  {
  }  // end default constructor
  </code></pre>
  
  <p><strong>Main CPP File</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "sorted.h"
  #include &lt;cstddef&gt;
  using namespace std;
  
  int main()
  {
      sorted&lt;string&gt; test;
      return 0;
  }
  </code></pre>
  
  <p>When I compile I get the errors/warnings
  1. redefinition of 'sorted::sorted() 
  2. sorted::sorted()' previously declared here</p>
  
  <p>When I comment out the #include "sorted.cpp" at the end of header file #2, it works, but then in my main file, it doesn't regonize my sorted test object.</p>
  
  <p>Any help would be great, thanks in advance.</p>