title: Member access into incomplete type error: Templatized struct C++
body: <p>Pretty new to C++ and having my first try at templates. I created a struct, <code>treeNode</code>, having left, right and parent pointers. I want the tree to be able to store multiple data types and hence am using templates. Whenever I try create an instance of the struct in the .cpp file, and then use it to access the left/right pointers of the tree I get this error: Member access into incomplete type struct 'treeNode'. Any idea on what I'm missing?</p>
  
  <p>Here is the code in the .h file(struct definition):</p>
  
  <pre><code>template &lt;class T&gt;
  struct treeNode {
      node&lt;T&gt; *l;
      node&lt;T&gt; *r;
      node&lt;T&gt; *p;   
  };
  </code></pre>
  
  <p>Here is my attempt in the .cpp file:</p>
  
  <pre><code>#include "RedBlack.h"
  
  struct treeNode* t;
  
  Tree::Tree() {
      t-&gt;l = NULL;
  }
  </code></pre>