I’m developing a basic engine, and now I’m working on the GUI part, I want
to use freetype2 for font-rendering. I use SDL for setting up OpenGL and
handling input etc.
The SDL docs say that I have to set the code generation for my project to
’Multithreaded DLL’, so I did that.
I then linked my program against freetype206MT_D.lib, but then I get
redefined symbol messages like this one:
libcmtd.lib(dbgheap.obj) : error LNK2005: _free already defined in
So I thought, lets be smart and add 2 new build configurations to the
freetype2 project: Multithreaded DLL and Debug Multithreaded DLL. Those
configurations produce freetype206DLLMT.lib and freetype206DLLMT_D.lib
When I link against freetype206DLLMT_D.lib I only get one linking warning:
MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib "msvcrt.lib"
conflicts with use of other libs; use / NODEFAULTLIB:library
When I then run my program I get a runtime error that reminds me to my DLL +
User breakpoint called from code .
According to the context it’s caused by an illegal heap pointer. Freetype
tries to free some memory using it’s internal memory-manager, which calls
free(), which calls some additional debug deallocation functions.
But the memory that causes the error is allocated by freetype2, and not by
So is it a freetype2 bug? Or is it caused by my 'custom code-generation’
Is there someone out there who had the same problem? And/or knows how to use
freetype2 together with SDL on Win32?
Or someone who just knows how to fix those linking/dependency problems? It’s
- Michel Stol