?
Solved

_endthread' undefined

Posted on 2001-08-25
6
Medium Priority
?
896 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 400 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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