title: Why do I keep getting this "undefined reference" error?
body: <pre><code>driver.cc
  #include &lt;iostream&gt;
  #include "dynStack.h"
  
  using namespace std;
  
  // class definition
  int main()
  {
    dynstack&lt;int&gt; c1;
  
  
    c1.push(1);
  
    cout&lt;&lt;"hello";
  
    return 0;
  }
  
  
  dynStack.h
  #include &lt;iostream&gt;
  
  using namespace std;
  
  template &lt;class T&gt;
  class dynstack
  {
      public:
          dynstack();
          void push(T data);
  
  
  };
  
  
  dynStack.cc
  
  #include "dynStack.h"
  
  template &lt;class T&gt;
  dynstack&lt;T&gt;::dynstack()
  {
  
  }
  
  template &lt;class T&gt;
  void dynstack&lt;T&gt;::push(T data)
  {
  
  
      return data;
  }
  </code></pre>
  
  <p>I'm new to C++. When I run the code, it keeps giving me "undefined reference to 'dynstack::dynstack()' error. I checked include and prototype and couldn't spot the error. Could anyone help me find where I did wrong? Thank you.</p>