Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
240 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

824 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