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
234 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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