Solved

How do I find out which libraries I need to include when my link fails in Visual C++

Posted on 2004-10-14
3
233 Views
Last Modified: 2010-04-24
Visual C++ (not .net)

My immediate problem is that the link fails -

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

I'd like to find out the library I need to include to find this function (AfxEndThread) and the method so that I can find any other unresolved references that may occur - ever.
0
Comment
Question by:rfr1tz
  • 2
3 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 12314878
What kind of project did you create?  AfxEndThread is an MFC function and _endthreadex is a C runtime function.  You need to link with a C runtime library such as msvcrtd.lib (debug multithreaded dll).  This should be automatic if you created an MFC project.  If it is not an MFC project, you should not use AfxEndThread.
0
 
LVL 19

Accepted Solution

by:
drichards earned 250 total points
ID: 12314944
As far as finding the libaries you need, you can look at the MS docs for the function in question.  They include information such as the header to include, the platforms on which the function is supported, and the library to link with.  See, for example, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__endthread.2c_._endthreadex.asp.  The "Libraries" section has a link to the C-runtime libraries page because this is not a simple use library x answer.
0
 
LVL 12

Expert Comment

by:OnegaZhang
ID: 12332197
The problem seems that you are using multithread feature but you are linking to single threaded library.
Please try the following steps:

Open project property dialog, goes to C/C++ --> Code generation

Runtime library : select Multithread ... to use multithreaded library.

welcome to www.fruitfruit.com
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now