Solved

linking error in vc++ Application

Posted on 2004-10-19
8
193 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamically allocate memory 9 59
C++ error cannot convert from std::string to const char * 6 185
max float value 3 41
How do i run a c++ file? 15 29
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

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