title: LNK2019 Unresolved External Symbol SHGetFolderPathW
body: <p>So,</p>
  
  <p>I've come across a strange error and I can't seem to find a solution for it. I'm writing this code on Qt Creator 3.1.1. The code is:</p>
  
  <pre><code>#include &lt;ShlObj.h&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  static std::wstring GetUserDirectory()
  {
      std::wstring returnPath;
      TCHAR path[MAX_PATH];
      HRESULT hr = SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL,
                                   SHGFP_TYPE_CURRENT, path);
      if (hr == S_OK)
      {
          returnPath = path;
          return returnPath;
      }
      else
      {
          return NULL;
      }
  }
  </code></pre>
  
  <p>When I try to build the program, I get the following linking errors:</p>
  
  <p>error: LNK2019: unresolved external symbol __imp_SHGetFolderPathW referenced in function "public: static class std::basic_string,class std::allocator > __cdecl FileUtils::GetUserDirectory(void)" (?GetUserDirectory@FileUtils@@SA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)</p>
  
  <p>error: LNK1120: 1 unresolved externals</p>
  
  <p>I'm assuming that these errors are related to the above code because from what I understand, SHGetFolderPath is just a wrapper for SHGetFolderPathW. However, I'm not sure why I'm getting this error. Any help would be appreciated.</p>
  
  <p>Thanks,</p>