Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why do I get an unresolved external (LNK2001) error on _beginthreadex and _endthreadex?

0
Posted

Why do I get an unresolved external (LNK2001) error on _beginthreadex and _endthreadex?

0

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.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.