title: Getting an "error LNK2019: unresolved external symbol"
body: <p>This is my code. It's to practice using templates.</p>
  
  <p>Header</p>
  
  <pre><code>#ifndef H_rectangleType
  #define H_rectangleType
  
  #include &lt;iostream&gt;
  
  using namespace std;
  
  namespace Rectangle{
  template &lt;class myType&gt;
  class rectangleType
  {
        //Overload the stream insertion and extraction operators
      friend ostream&amp; operator &lt;&lt; (ostream&amp;, const rectangleType &amp;);
      friend istream&amp; operator &gt;&gt; (istream&amp;, rectangleType &amp;);
  
  public:
      void setDimension(myType l, myType w);
      myType getLength() const;
      myType getWidth() const;
      myType area() const;
      myType perimeter() const;
      void print() const;
  
      rectangleType&lt;myType&gt; operator+(const rectangleType&lt;myType&gt;&amp;) const;
        //Overload the operator +
      rectangleType&lt;myType&gt; operator*(const rectangleType&lt;myType&gt;&amp;) const;
        //Overload the operator *
  
          bool operator==(const myType&amp;) const;
        //Overload the operator ==
      bool operator!=(const myType&amp;) const;
        //Overload the operator !=
  
      rectangleType();
      rectangleType(myType l, myType w);
  
  private:
      myType length;
      myType width;
  };
  }
  
  
  #endif
  </code></pre>
  
  <p>Member Definitions</p>
  
  <pre><code>#include &lt;iostream&gt; 
  #include "rectangleType.h"
  
  using namespace std;
  
  namespace Rectangle{
  template &lt;class myType&gt;
  void rectangleType&lt;myType&gt;::setDimension(myType l, myType w)
  {
      if (l &gt;= 0) 
          length = l;
      else
          length = 0;
  
      if (w &gt;= 0)
          width = w;
      else
          width = 0;
  }
  
  template &lt;class myType&gt;
  myType rectangleType&lt;myType&gt;::getLength() const
  {
      return length;
  }
  
  template &lt;class myType&gt;
  myType rectangleType&lt;myType&gt;::getWidth()const
  {
      return width;
  }
  
  template &lt;class myType&gt;
  myType rectangleType&lt;myType&gt;::area() const
  {
      return length * width;
  }
  
  template &lt;class myType&gt;
  myType rectangleType&lt;myType&gt;::perimeter() const
  {
      return 2 * (length + width);
  }
  
  template &lt;class myType&gt;
  void rectangleType&lt;myType&gt;::print() const
  {
      cout &lt;&lt; "Length = "  &lt;&lt; length
           &lt;&lt; "; Width = " &lt;&lt; width;
  }
  
  template &lt;class myType&gt;
  rectangleType&lt;myType&gt;::rectangleType(myType l, myType w)
  {
      setDimension(l, w);
  }    
  
  template &lt;class myType&gt;
  rectangleType&lt;myType&gt;::rectangleType()
  {
      length = 0;
      width = 0;
  }
  
  template &lt;class myType&gt;
  rectangleType&lt;myType&gt; rectangleType&lt;myType&gt;::operator+ 
                            (const rectangleType&lt;myType&gt;&amp; rectangle) const
  {
      rectangleType&lt;myType&gt; tempRect;
  
      tempRect.length = length + rectangle.length;
      tempRect.width = width + rectangle.width;
  
      return tempRect;
  }
  
  template &lt;class myType&gt;
  rectangleType&lt;myType&gt; rectangleType&lt;myType&gt;::operator* 
                         (const rectangleType&lt;myType&gt;&amp; rectangle) const
  {
      rectangleType&lt;myType&gt; tempRect;
  
      tempRect.length = length * rectangle.length;
      tempRect.width = width * rectangle.width;
  
      return tempRect;
  }
  
  template &lt;class myType&gt;
  bool rectangleType&lt;myType&gt;::operator== 
                        (const myType&amp; rectangle) const
  {
      return (length == rectangle.length &amp;&amp;
              width == rectangle.width);
  }
  
  template &lt;class myType&gt;
  bool rectangleType&lt;myType&gt;::operator!= 
                         (const myType&amp; rectangle) const
  {
      return (length != rectangle.length ||
              width != rectangle.width);
  }
  
  template &lt;class myType2&gt;
  ostream&amp; operator &lt;&lt; (ostream&amp; osObject, 
                        const rectangleType&lt;myType2&gt;&amp; rectangle)
  {
      osObject &lt;&lt; "Length = "  &lt;&lt; rectangle.length 
               &lt;&lt; "; Width = " &lt;&lt; rectangle.width;
  
  return osObject;
  }
  
  template &lt;class myType2&gt;
  istream&amp; operator &gt;&gt; (istream&amp; isObject, 
                        rectangleType&lt;myType2&gt;&amp; rectangle)
  {
      isObject &gt;&gt; rectangle.length &gt;&gt; rectangle.width;
  
      return isObject;
  }
  }
  </code></pre>
  
  <p>Main</p>
  
  <pre><code>#include &lt;iostream&gt;                                   //Line 1
  
  #include "rectangleType.h"                            //Line 2
  
  using namespace std;                                  //Line 3
  using namespace Rectangle;
  
  int main()                                            //Line 4
  {                                                     //Line 5
      cout &lt;&lt; "Enter the type of your Rectangle.\n1. int\n2. double\n3. float";
          rectangleType&lt;double&gt; myRectangle(23, 45);                //Line 6
      int int1 = 1;
      int double1 = 2;
      int float1 = 3;
      int temp= 0;
      cin &gt;&gt; temp;                                                      //Line 7
  
      if(temp == int1)
      {   
      rectangleType&lt;int&gt; myRectangle(23, 45);   
      rectangleType&lt;int&gt; yourRectangle;
          cout &lt;&lt; "Line 8: myRectangle: " &lt;&lt; myRectangle 
       &lt;&lt; endl;                                     
  
          cout &lt;&lt; "Line 9: Enter the length and width "
               &lt;&lt;"of a rectangle: ";                        
          cin &gt;&gt; yourRectangle;                            
          cout &lt;&lt; endl;                                    
  
          cout &lt;&lt; "Line 12: yourRectangle: "
               &lt;&lt; yourRectangle &lt;&lt; endl;                    
  
          cout &lt;&lt; "Line 13: myRectangle + yourRectangle: " 
                       &lt;&lt; myRectangle + yourRectangle &lt;&lt; endl;     
          cout &lt;&lt; "Line 14: myRectangle * yourRectangle: " 
                   &lt;&lt; myRectangle * yourRectangle &lt;&lt; endl;
      } 
  
      if(temp == double1)
      {   
          rectangleType&lt;double&gt; myRectangle(23, 45);   
      rectangleType&lt;double&gt; yourRectangle;
      cout &lt;&lt; "Line 8: myRectangle: " &lt;&lt; myRectangle 
       &lt;&lt; endl;                                     
  
      cout &lt;&lt; "Line 9: Enter the length and width "
           &lt;&lt;"of a rectangle: ";                        
      cin &gt;&gt; yourRectangle;                            
      cout &lt;&lt; endl;                                    
  
      cout &lt;&lt; "Line 12: yourRectangle: "
           &lt;&lt; yourRectangle &lt;&lt; endl;                    
  
      cout &lt;&lt; "Line 13: myRectangle + yourRectangle: " 
           &lt;&lt; myRectangle + yourRectangle &lt;&lt; endl;     
      cout &lt;&lt; "Line 14: myRectangle * yourRectangle: " 
           &lt;&lt; myRectangle * yourRectangle &lt;&lt; endl;
  } 
  
  if(temp == float1)
  {   
      rectangleType&lt;float&gt; myRectangle(23, 45);   
      rectangleType&lt;float&gt; yourRectangle;
      cout &lt;&lt; "Line 8: myRectangle: " &lt;&lt; myRectangle 
       &lt;&lt; endl;                                     
  
      cout &lt;&lt; "Line 9: Enter the length and width "
           &lt;&lt;"of a rectangle: ";                        
      cin &gt;&gt; yourRectangle;                            
      cout &lt;&lt; endl;                                    
  
      cout &lt;&lt; "Line 12: yourRectangle: "
           &lt;&lt; yourRectangle &lt;&lt; endl;                    
  
      cout &lt;&lt; "Line 13: myRectangle + yourRectangle: " 
           &lt;&lt; myRectangle + yourRectangle &lt;&lt; endl;     
      cout &lt;&lt; "Line 14: myRectangle * yourRectangle: " 
           &lt;&lt; myRectangle * yourRectangle &lt;&lt; endl;
  } 
  return 0;                                         
  </code></pre>
  
  <p>}</p>
  
  <p>Here,I'm getting these errors</p>
  
  <pre><code>1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: class                                   Rectangle::rectangleType&lt;float&gt; __thiscall Rectangle::rectangleType&lt;float&gt;::operator*(class Rectangle::rectangleType&lt;float&gt; const &amp;)const " (??D?$rectangleType@M@Rectangle@@QBE?AV01@ABV01@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: class Rectangle::rectangleType&lt;float&gt; __thiscall Rectangle::rectangleType&lt;float&gt;::operator+(class Rectangle::rectangleType&lt;float&gt; const &amp;)const " (??H?$rectangleType@M@Rectangle@@QBE?AV01@ABV01@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp; __cdecl Rectangle::operator&gt;&gt;(class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class Rectangle::rectangleType&lt;float&gt; &amp;)" (??5Rectangle@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV12@AAV?$rectangleType@M@0@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp; __cdecl Rectangle::operator&lt;&lt;(class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class Rectangle::rectangleType&lt;float&gt; const &amp;)" (??6Rectangle@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABV?$rectangleType@M@0@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: __thiscall Rectangle::rectangleType&lt;float&gt;::rectangleType&lt;float&gt;(void)" (??0?$rectangleType@M@Rectangle@@QAE@XZ) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: __thiscall Rectangle::rectangleType&lt;float&gt;::rectangleType&lt;float&gt;(float,float)" (??0?$rectangleType@M@Rectangle@@QAE@MM@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: class Rectangle::rectangleType&lt;double&gt; __thiscall Rectangle::rectangleType&lt;double&gt;::operator*(class Rectangle::rectangleType&lt;double&gt; const &amp;)const " (??D?$rectangleType@N@Rectangle@@QBE?AV01@ABV01@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: class Rectangle::rectangleType&lt;double&gt; __thiscall Rectangle::rectangleType&lt;double&gt;::operator+(class Rectangle::rectangleType&lt;double&gt; const &amp;)const " (??H?$rectangleType@N@Rectangle@@QBE?AV01@ABV01@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp; __cdecl Rectangle::operator&gt;&gt;(class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class Rectangle::rectangleType&lt;double&gt; &amp;)" (??5Rectangle@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV12@AAV?$rectangleType@N@0@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp; __cdecl Rectangle::operator&lt;&lt;(class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class Rectangle::rectangleType&lt;double&gt; const &amp;)" (??6Rectangle@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABV?$rectangleType@N@0@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: __thiscall Rectangle::rectangleType&lt;double&gt;::rectangleType&lt;double&gt;(void)" (??0?$rectangleType@N@Rectangle@@QAE@XZ) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: class Rectangle::rectangleType&lt;int&gt; __thiscall Rectangle::rectangleType&lt;int&gt;::operator*(class Rectangle::rectangleType&lt;int&gt; const &amp;)const " (??D?$rectangleType@H@Rectangle@@QBE?AV01@ABV01@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: class Rectangle::rectangleType&lt;int&gt; __thiscall Rectangle::rectangleType&lt;int&gt;::operator+(class Rectangle::rectangleType&lt;int&gt; const &amp;)const " (??H?$rectangleType@H@Rectangle@@QBE?AV01@ABV01@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp; __cdecl Rectangle::operator&gt;&gt;(class std::basic_istream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class Rectangle::rectangleType&lt;int&gt; &amp;)" (??5Rectangle@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@std@@AAV12@AAV?$rectangleType@H@0@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp; __cdecl Rectangle::operator&lt;&lt;(class std::basic_ostream&lt;char,struct std::char_traits&lt;char&gt; &gt; &amp;,class Rectangle::rectangleType&lt;int&gt; const &amp;)" (??6Rectangle@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@ABV?$rectangleType@H@0@@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: __thiscall Rectangle::rectangleType&lt;int&gt;::rectangleType&lt;int&gt;(void)" (??0?$rectangleType@H@Rectangle@@QAE@XZ) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: __thiscall Rectangle::rectangleType&lt;int&gt;::rectangleType&lt;int&gt;(int,int)" (??0?$rectangleType@H@Rectangle@@QAE@HH@Z) referenced in function _main
  1&gt;testOpOverLoadClass.obj : error LNK2019: unresolved external symbol "public: __thiscall Rectangle::rectangleType&lt;double&gt;::rectangleType&lt;double&gt;(double,double)" (??0?$rectangleType@N@Rectangle@@QAE@NN@Z) referenced in function _main
  1&gt;C:\Users\jr\Documents\Visual Studio 2010\Projects\CMPE 126\Lab 2\Debug\Lab 2.exe : fatal error LNK1120: 18 unresolved externals
  </code></pre>
  
  <p>I cant seem to make what these errors mean. Thanks inadvance</p>