Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 814
  • Last Modified:

LNK2019 - Unresolved CreateThread - Trying to compile WIndows service

I'm writing a windows service, and I have additioanl dependenceis for the linker set to include kernel32.lib and I am inlcuding windows.hhowever when I try to build I still get this linker error:

error LNK2019: unresolved external symbol __beginthreadex referenced in function "public: int __thiscall CWinThread::CreateThread(unsigned long,unsigned int,struct _SECURITY_ATTRIBUTES *)" (?CreateThread@CWinThread@@QAEHKIPAU_SECURITY_ATTRIBUTES@@@Z)

 as well as this one:

error LNK2019: unresolved external symbol __endthreadex referenced in function "void __stdcall AfxEndThread(unsigned int,int)" (?AfxEndThread@@YGXIH@Z)

I am actually not using threading anywhere that I know of and after searching thorugh the project code I couldn't find one call to either of these functions.  Not sure what is going on here??

1 Solution
To use _beginthread or _beginthreadex, the application must link with one of the multithreaded C run-time libraries.
ptrennumAuthor Commented:
Thank you - that was kinda dumb of me, didn't even think about that.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now