Solved

_endthread' undefined

Posted on 2001-08-25
6
885 Views
Last Modified: 2012-05-04
When I compile my program, I receive the following error. I searched for these functions, and found them in process.h. However, I still receive the error when I include this header file; also, I receive the same error for _main?

1) Compiler error
Compiling...
dn.c
F:\Program Files\Microsoft Visual Studio\MyProjects\Dn_files\dn.c(1897) : warning C4013: '_endthread' undefined; assuming extern returning int
F:\Program Files\Microsoft Visual Studio\MyProjects\Dn_files\dn.c(1931) : warning C4013: '_beginthread' undefined; assuming extern returning int

dn.obj - 0 error(s), 2 warning(s)


2) Header section of pgm:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <ctype.h>
#include <process.h>


#include "nntp.h"
#include "dnwin.h"
0
Comment
Question by:ronandersen
[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
  • 3
  • 3
6 Comments
 
LVL 3

Accepted Solution

by:
kulina earned 100 total points
ID: 6425350
By default compiler links with C runtime that doesn't support multihreading.  You have to link explicitly with multithreaded version of C runtime which is (in case of MS VS 6):
LIBCMT.LIB if you are linking staticaly, or
MSVCRT.LIB if you are linking dynamicaly

You can do this as follows (on file by file basis):
1. From the file menu open Project-.Project Settings
2. In "Setting For" box click on the file you wish to link with MT version of CRT
3. Click on th "C/C++" dialog tab.
4. Under "Category" drop-down list select "Code Generation"
5. Under "Use runtime library" select "Multithreaded" for static linking or "Multithreaded DLL" for dynamic linking.

Hope this helps.

0
 

Author Comment

by:ronandersen
ID: 6425528
kulina,

This resolved the _end* and _begin warnings, but I still receive the following error:


Linking...
LIBCD.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/dnwin.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

dnwin.exe - 2 error(s), 0 warning(s)
0
 
LVL 3

Expert Comment

by:kulina
ID: 6425586
This is because the linker can't find the entry point of your application (which is main() for EXE files). Is the file which contains function int main(){...} included in your project? There can be many other reasons for this, so I believe the best thing would be to send your project to me at kulina@home.com . It's easier for me to check it out, find the cause, and fix it rather than guesing your configuration...
Rgds.
0
Independent Software Vendors: 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!

 

Author Comment

by:ronandersen
ID: 6426457
Kulina,

I will zip up the project and send it to kulina@home.com
0
 

Author Comment

by:ronandersen
ID: 6427286
Thank you - it compiled and linked perfectly!
0
 
LVL 3

Expert Comment

by:kulina
ID: 6427514
Thanks. Here is the problem report for anybody who may purchase this Q:
Since this is a Win32 application, you have to indicate that in the project settings; otherwise the compiler will think that this is a regular C/C++ app, and linker will look for main() instead of WinMain(). The easiest way to do that is to start "clean" Win32 Application project...
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

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

691 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