Setting the C/C++ Code Generation Runtime Library to Multi-threaded Debug DLL (/MDd) helps in Visual Studio 2012, but when I compiled my code in Visual Studio 2013 Preview and ran it, even that option led to the runtime error mentioned above. So it is probably not only a static linking problem.