Why do I get an unresolved external (LNK2001) error on _beginthreadex and _endthreadex?
This happens when you compile a project that uses MFC, but your compiler settings are set to use the single-threaded version of the C runtime library (CRT). Since MFC uses threads, it requires the multithreaded CRT. Since the single-threaded CRT doesn’t contain _beginthreadex() and _endthreadex(), you get a linker error on those two functions. To change your CRT setting, click Project->Settings and go to the C/C++ tab. Set the Category combo box to Code Generation. In the Use run-time library combo box, chose one of the multithreaded versions of the CRT. For debug builds, choose Debug Multithreaded or Debug Multithreaded DLL. For release builds, choose Multithreaded or Multithreaded DLL. The versions that say “DLL” use MSVCRT.DLL, while the others do not depend on that DLL.