Solved

linking error in vc++ Application

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

747 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

17 Experts available now in Live!

Get 1:1 Help Now