title: Unresolved tokens in C++/CLI
body: <p>I'm getting linker errors for one of the classes I created.</p>
  
  <pre><code>1&gt;Dict.obj : error LNK2020: unresolved token (06000006) TwoKeyDict&lt;System::String ^,int&gt;::.ctor
  1&gt;Dict.obj : error LNK2020: unresolved token (06000007) TwoKeyDict&lt;System::String ^,int&gt;::Get
  1&gt;Dict.obj : error LNK2020: unresolved token (06000008) TwoKeyDict&lt;System::String ^,int&gt;::Put
  1&gt;Dict.obj : error LNK2020: unresolved token (06000009) TwoKeyDict&lt;int,int&gt;::.ctor
  1&gt;Dict.obj : error LNK2020: unresolved token (0600000A) TwoKeyDict&lt;int,int&gt;::Get
  1&gt;Dict.obj : error LNK2020: unresolved token (0600000B) TwoKeyDict&lt;int,int&gt;::Put
  </code></pre>
  
  <p>These are in all the places that I try to use the class. Here's the code for the class:</p>
  
  <p>TwoKeyDict.h</p>
  
  <pre><code>#pragma once
  
  using namespace System::Collections::Generic;
  
  template&lt;class K, class V&gt;
  public ref class TwoKeyDict
  {
  private:
      Dictionary&lt;K, Dictionary&lt;K, V&gt;^&gt;^ underlyingDict;
  public:
      TwoKeyDict();
      V Get(K key1, K key2);
      void Put(K key1, K key2, V value);
  };
  </code></pre>
  
  <p>TwoKeyDict.cpp</p>
  
  <pre><code>#include "StdAfx.h"
  #include "TwoKeyDict.h"
  
  template&lt;class K, class V&gt;
  TwoKeyDict&lt;K, V&gt;::TwoKeyDict() {
      underlyingDict = gcnew Dictionary&lt;K, Dictionary&lt;K, V&gt;^&gt;();
  }
  
  template&lt;class K, class V&gt;
  V TwoKeyDict&lt;K, V&gt;::Get(K key1, K key2) {
      if (underlyingDict-&gt;ContainsKey(key1)) {
          if (underlyingDict[key1]-&gt;ContainsKey(key2)) {
              return underlyingDict[key1][key2];
          }
      }
  
      return nullptr;
  }
  
  template&lt;class K, class V&gt;
  void TwoKeyDict&lt;K, V&gt;::Put(K key1, K key2, V value) {
      if (underlyingDict-&gt;ContainsKey(key1)) {
          Dictionary&lt;K, V&gt;^&gt;^ secondLayerDict = underlyingDict[key1];
          if (secondLayerDict-&gt;ContainsKey(key2)) {
              secondLayerDict[key2] = value;
          } else {
              secondLayerDict-&gt;Add(key2, value);
          }
      } else {
          Dictionary&lt;K, V&gt;^&gt;^ secondLayerDict = gcnew Dictionary&lt;K, V&gt;^&gt;();
          secondLayerDict-&gt;Add(key2, value);
          underlyingDict-&gt;Add(key1, secondLayerDict);
      }
  }
  </code></pre>
  
  <p>In the places that I'm trying to use it I'm just doing #include "TwoKeyDict.h"</p>