title: C++ undefined reference to `Graph<char>::Graph(int)
body: <p>I was wondering if anyone could help me with this.</p>
  <p>I was trying to make a graph class, but when I try to compile I get an undefined error.</p>
  <p>The code is as follows:</p>
  <p>graph.h</p>
  <pre><code>
  template &lt;class T&gt;
  class Graph
  {
    ...
    public:
     Graph(int);
  
  };
  </code></pre>
  <p>graph.cpp</p>
  <pre><code>#include &quot;graph.h&quot;
  
  template&lt;class T&gt;
  Graph&lt;T&gt;::Graph(int n)
  {
    ...
  }
  
  </code></pre>
  <p>main.cpp</p>
  <pre><code>#include &lt;iostream&gt;
  #include &quot;graph.h&quot;
  
  using namespace std;
  
  int main()
  {
    Graph&lt;char&gt; *gr = new Graph&lt;char&gt;(5);
  
    return 0;
  }
  
  </code></pre>
  <p>If I try to compile with:</p>
  <p>g++ -c *.cpp  no errors</p>
  <p>g++ *.o  i get &quot;undefined reference to Graph::Graph(int)&quot;.</p>
  <p>I'm new on StackOverFlow, so please forgive me If I did something wrong.</p>
  <p>I hope you can help me</p>