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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

18 Experts available now in Live!

Get 1:1 Help Now