Solved

linking error in vc++ Application

Posted on 2004-10-19
8
192 Views
Last Modified: 2010-04-01
I m making a vc++ Application
 When I build the application in debug mode it is not giving any linking error
but in Release Mode it gives 2 errors

nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex

What's the problem
can someone give the solution for it

leork
0
Comment
Question by:zxcvbnm
8 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 12347791
Go to your project settings, choose the C++ tab, select 'Code generation' and change the settings to "Use Runtime Library" to "Multithreaded DLL" (either Debug or Release), so the correct .lib will be used when linking.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 12347805
Project - Settings - C++. Select Win32 Release configuration. Select Code Generation in the Category combo box. Select Multithreaded in the run-time library combo box.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 12347811
Too slow  :-(
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 12348088
I think you can also get this error if you are building an MFC project from scratch, i.e. from a blank workspace then adding the project files.  In this case you need to link with MFC either statically or dynamically.

But jkr/AlexFM are probably right...:)
0
 
LVL 17

Expert Comment

by:rstaveley
ID: 12348266
jkr/AlexFM are right.

If you use the C Run-time library (i.e. you're a normal C/C++ developer) you need to use _beginthreadex to create threads because it puts a wrapper around the Win32 function CreateThread to allow C Run-time library static structures to be aware of the thread. The multi-threaded library has some extra stuff in it to deal with different threads accessing static data and only the multi-threaded library has _beginthreadex.

You *can* use CreateThread and use single threaded Run-time library, which doesn't have the additional overhead, but you'd need to steer away from C run-time library calls which use static data and use weird and wonderful stuff like CreateFile for I/O in preference to your old friends in <stdio.h>.
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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

863 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

24 Experts available now in Live!

Get 1:1 Help Now