title: Undefined reference to template member function
body: <p>I'm using Qt 5.5.1 and am trying to use a template class for some properties in my application but on build I'm getting undefined references to each type of that template class.</p>
  
  <p>This build used to work in MSVC++ 2015 but after switching to Qt I believe I might not be following some syntactical convention?</p>
  
  <p><strong>Here is my header file:</strong></p>
  
  <pre><code>#include &lt;array&gt;
  #include &lt;string&gt;
  using namespace std;
  
  template &lt;const int SIZE&gt;
  class Property
  {
  public:
      Property(const array&lt;pair&lt;int, string&gt;, SIZE&gt;* properties);
      ~Property();
      string getPropertyValue(int code);
  private:
      const array&lt;pair&lt;int, string&gt;, SIZE&gt;* mProperties;
  };
  </code></pre>
  
  <p><strong>Here is my source file:</strong></p>
  
  <pre><code>#include "Property.h"
  
  template &lt;const int SIZE&gt;
  Property&lt;SIZE&gt;::Property(const array&lt;pair&lt;int, string&gt;, SIZE&gt;* properties)
  {
      mProperties = properties;
  }
  
  template &lt;const int SIZE&gt;
  Property&lt;SIZE&gt;::~Property() {}
  
  template &lt;const int SIZE&gt;
  string Property&lt;SIZE&gt;::getPropertyValue(int code)
  {
      for (int i = 0; i &lt; SIZE; i++) 
      {
          if( code == mProperties[0][i].first )
          {
               return mProperties[0][i].second;
          }
      }
  
      string("no value found");
  }
  </code></pre>
  
  <p><strong>Here is my implementation:</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "Property.h"
  using namespace std;
  
  const int arrSize = 1;
  const array&lt;pair&lt;int, string&gt;, arrSize&gt; arrValues{
      make_pair(0x02, string("String Value"))
  };
  
  int main()
  {
      Property&lt;arrSize&gt;* properties = new Property&lt;arrSize&gt;(&amp;arrValues);
      cout &lt;&lt; properties-&gt;getPropertyValue(2) &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p><strong>Here is my build output:</strong></p>
  
  <pre><code>undefined reference to `Property&lt;1&gt;::Property(std::array&lt;std::pair&lt;int, std::string&gt;, 1u&gt; const*)'
  undefined reference to `Property&lt;1&gt;::getPropertyValue(int)'
  </code></pre>
  
  <p>I want to have multiple properties and the compiler complains about each different size Property&lt;2>:: ... Property&lt;44>:: ... etc... Any help would be greatly appreciated. Also, what is a better way to do code/value lookup like this?</p>
  
  <p>Thanks!</p>