I built Freetype 2.9 from source in VS2017 into a static library by choosing Debug Multithreaded/SingleThreaded configuration. Seemingly, the static library is placed in freetype-2.9\objs\x64\Debug Static\freetype.lib.
In VS2017, in Additional Library Directories I added freetype-2.9\objs\x64\Debug Static. In Additional Dependencies I added freetype.lib. And set Runtime Library to MTd. However compilation throws the linker errors:
1>------ Build started: Project: HelloFreetype, Configuration: Debug x64 ------
1>Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol __imp_FT_Init_FreeType referenced in function main
1>Source.obj : error LNK2019: unresolved external symbol __imp_FT_Done_FreeType referenced in function main
1>C:\Users\joaqo\Documents\HelloFreetype\x64\Debug\HelloFreetype.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "HelloFreetype.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Freetype has unusual uses for the preprocessor, so here is the code as well:
#include <ft2build.h>
#include FT_FREETYPE_H
int main(int argc, char **argv)
{
FT_Library library;
int error = FT_Init_FreeType(&library);
if (error) {
printf("FreeType: Initilization error\n");
exit(EXIT_FAILURE);
}
FT_Done_FreeType(library);
exit(EXIT_SUCCESS);
}
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!
Thanks for any help!