title: C++ Connecting two .cpp files
body: <p>I have a problem connecting two .cpp files in C++. Here are my files</p>
  
  <p>Header.h</p>
  
  <pre><code>//Header.h
  template &lt;class T&gt; class asd{
  asd();
  check();
  print();
  }
  </code></pre>
  
  <p>file1.cpp</p>
  
  <pre><code>//file1.cpp
  //defines all methods in class asd
  #include "Header.h"
  template&lt;class T&gt; asd&lt;T&gt;:: asd(T a, T b){//codes}
  template&lt;class T&gt; T asd&lt;T&gt;:: check(T a){//codes}
  template&lt;class T&gt; void asd&lt;T&gt;::print(){//codes}
  </code></pre>
  
  <p>file2.cpp</p>
  
  <pre><code>//file2.cpp
  //main method
  #include "Header.h"
  int main(){//codes}
  </code></pre>
  
  <p>The thing I do not understand is that the code runs fine when I put main() inside file1.cpp, but it wont compile when I separate them into two files. Can someone please give pointers?</p>
  
  <p>Edit:
  For those with the same problem, solution can be found here:
  <a href="http://www.cplusplus.com/forum/articles/14272/" rel="nofollow">http://www.cplusplus.com/forum/articles/14272/</a></p>