Solved

linking error in vc++ Application

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting IP address 8 104
Would like to move button in a function 3 86
Need some help with Microsoft Visual Studio C++ 2003 5 74
Error creating a new C++ project in ,net 20 51
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…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

696 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