title: How to statically link FreeType2 in Visual Studio?
body: <p>I built Freetype 2.9 from source in VS2017 into a static library by choosing <em>Debug Multithreaded/SingleThreaded</em> configuration. Seemingly, the static library is placed in <em>freetype-2.9\objs\x64\Debug Static\freetype.lib</em>.</p>
  
  <p>In VS2017, in <em>Additional Library Directories</em> I added <em>freetype-2.9\objs\x64\Debug Static</em>.
  In <em>Additional Dependencies</em> I added <em>freetype.lib</em>. And set <em>Runtime Library</em> to <em>MTd</em>.
  However compilation throws the linker errors:</p>
  
  <pre><code>1&gt;------ Build started: Project: HelloFreetype, Configuration: Debug x64 ------
  1&gt;Source.cpp
  1&gt;Source.obj : error LNK2019: unresolved external symbol __imp_FT_Init_FreeType referenced in function main
  1&gt;Source.obj : error LNK2019: unresolved external symbol __imp_FT_Done_FreeType referenced in function main
  1&gt;C:\Users\joaqo\Documents\HelloFreetype\x64\Debug\HelloFreetype.exe : fatal error LNK1120: 2 unresolved externals
  1&gt;Done building project "HelloFreetype.vcxproj" -- FAILED.
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>Freetype has unusual uses for the preprocessor, so here is the code as well:</p>
  
  <pre><code>#include &lt;ft2build.h&gt;
  #include FT_FREETYPE_H
  
  int main(int argc, char **argv)
  {
      FT_Library  library;
      int error = FT_Init_FreeType(&amp;library);
      if (error) {
          printf("FreeType: Initilization error\n");
          exit(EXIT_FAILURE);
      }
      FT_Done_FreeType(library);
      exit(EXIT_SUCCESS);
  }
  </code></pre>
  
  <p>Same error happens with x86 platform, release configuration and/or retargeting Windows SDK to 8.1 (Freetype was built with SDK 8.1 too). Also tried without success with Freetype 2.7.1. And trying to link to dynamic library is no problem at all!</p>
  
  <p>Thanks for any help!</p>