title: clang error linker command failed
body: <p>There are quite a few posts like this on SO but most of them pertain to xcode, and I cannot replicate their solutions. I have a Heap.h, Heap.cpp, and main.cpp and whenever I try to run main.cpp with <code>g++ main.cpp Heap.cpp</code>, it gives me:</p>
  
  <p><code>clang: error: linker command failed with exit code 1 (use -v to see invocation)</code></p>
  
  <p>Heap.h</p>
  
  <pre><code>#ifndef _HEAP_H_
  #define _HEAP_H_
  
  template&lt;class T&gt;
  class Heap{
      private:
          struct Node{
              T *dist;
              T *v;
  
              bool operator==(const Node&amp; a){
                  return *dist == *(a -&gt; dist);
              }
  
              bool operator!=(const Node&amp; a){
                  return (!(*dist == *(a -&gt; dist)));
              }
  
          };
  
          Node *container;
          int size;
          int curSize;
          T sourceV;        
  
      public:
          Heap();
          Heap(int inSize, T inSourceV);
  
  };
  
      #endif
  </code></pre>
  
  <p>Heap.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;limits&gt;
  #include "Heap.h"
  
  using namespace std;
  
  template&lt;class T&gt;
  Heap&lt;T&gt;::Heap(){
      cout &lt;&lt; "hello" &lt;&lt;endl;
  }
  
  template&lt;class T&gt;
  Heap&lt;T&gt;::Heap(int inSize, T inSourceV){
      size = inSize;
      container = new Node[size];
      curSize = 0;
      sourceV = inSourceV;
  
      int maxVal = numeric_limits&lt;int&gt;::max();
      for (int i = 1; i &lt; size; i++){
          container[i].dist = &amp;maxVal;
          container[i].v = &amp;maxVal;
      }
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "Heap.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(){
     Heap &lt;int&gt; h; 
  }
  </code></pre>
  
  <p>What is strange is, I have another project that contains bst.h bst.cpp main.cpp and those run fine. The difference between these two projects is that the bst I implemented is not templated class. </p>
  
  <p>I also saw another similar post that mentioned something about changing bitcode settings, but I have no idea where to access that from. Any ideas?</p>
  
  <p>I'm running xcode 7.1. Apple LLVM version 7.0.0 (clang-700.1.76)
  Target: x86_64-apple-darwin14.5.0
  Thread model: posix </p>