?
Solved

linking error in vc++ Application

Posted on 2004-10-19
8
Medium Priority
?
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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