473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

_beginthread()

I am trying to test out _beginthread() but I keep getting an error that:

_beginthread : undeclared identifier
I am using Visuall C++ with DotNET Studio and am on windows XP.

Here is the full program:

************************************************** *****************

#include <windows.h>

#include <process.h>

HANDLE mainthread;

void beepthread(void *)

{

DWORD xitcode;

while (GetExitCodeThread(mainthread, &xitcode)&&xitcode==STILL_ACTIVE)

{

MessageBeep(-1);

Sleep(1000);

}

}

void main()

{

mainthread=GetCurrentThread();

_beginthread(beepthread,0,NULL);

MessageBox(NULL,"Red Alert","Alert",MB_OK);

}

************************************************** **************************
Nov 17 '05 #1
6 1874
dude wrote:
I am trying to test out _beginthread() but I keep getting an error
that:

_beginthread : undeclared identifier


Please use the multithreaded version of the CRT

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #2

"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn**********************************@207.46.2 48.16...
dude wrote:
I am trying to test out _beginthread() but I keep getting an error
that:

_beginthread : undeclared identifier
Please use the multithreaded version of the CRT


but since I include the process.h header which has _beginthread() in it
shouldn't that let me use that?

anyway I am used to VC++ 6.0 and really can't find where I would change
that. where do I change any of these settings?
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 17 '05 #3
Hi dude,
> _beginthread : undeclared identifier


Please use the multithreaded version of the CRT


I am used to VC++ 6.0 and really can't find where I would change
that. where do I change any of these settings?


"Project|Settings|C/C++|Code generation|Use runtime library: (Debug)
multithreaded"

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #4

"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn**********************************@207.46.2 48.16...
Hi dude,
> _beginthread : undeclared identifier

Please use the multithreaded version of the CRT
I am used to VC++ 6.0 and really can't find where I would change
that. where do I change any of these settings?


"Project|Settings|C/C++|Code generation|Use runtime library: (Debug)
multithreaded"


OK, thanks but now I am getting link errors:

error LNK2019: unresolved external symbol _WinMain@16 referenced in function
_WinMainCRT Startup

and

fatal error LNK1120: 1 unresolved externals

is trying to create a small app using multithreading always like this???
JAVA isn't this picky... ;)
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 17 '05 #5
Hi dude,
error LNK2019: unresolved external symbol _WinMain@16 referenced in
function _WinMainCRT Startup


1. What are you doing?
- Are you creating a simple console app?
- Are you creating a simple window app?
- Are you using the CRT?

2. What is the name of your "main" function?

3. How have you created your project and compilter/linker settings?
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #6

"Jochen Kalmbach" <no********************@holzma.de> wrote in message
news:Xn**********************************@207.46.2 48.16...
Hi dude,
error LNK2019: unresolved external symbol _WinMain@16 referenced in
function _WinMainCRT Startup
1. What are you doing?
- Are you creating a simple console app?
- Are you creating a simple window app?
- Are you using the CRT?

2. What is the name of your "main" function?

3. How have you created your project and compilter/linker settings?

i am just trying to create the simple program using threads. the full
program is listed.

i selected C++ win32 project and was using the default settings.

i just have the one cpp file in the project. the only setting i changed was
the CRT when you suggested it.

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Ilia Poliakov | last post by:
Can I run a thread with _beginthread() and pass as the first parameter the pointer on a member function of a class? #include <process.h> class A { void _cdecl f(void*) {}; };
9
by: liangbowen | last post by:
As i konw, the only way to to terminate a thread started by _beginthread() is to user _endthread() (or return) inside the thread. now i started a thread(TodoThread), and created a listenning...
2
by: Altman | last post by:
I have a class called cScale, I have made an array of scale objects and I need to run a method of these objects as a new thread. This is my line of code and I can't get it to run. I am still a...
5
by: JHoletzeck | last post by:
Is it possible to set the stack size for the thread created by BackgroundWorker like in the API call _beginthread? If not is the stack size a default or the one I set for the whole application?...
3
by: shell6 | last post by:
I get a few errors building a prog with _beginthread. I have done the proper compile options and included libcmt.lib in linking, but I still get these errors: libcimtd.lib(streamb.obj) : error...
1
by: akoolb | last post by:
_beginthread( function, 0, (void*)(int)num); That's what I'm using, what I need to know is how can I send more than one parameter with it, I've spent a while searching and can't find the answer. ...
11
by: sturlamolden | last post by:
Python has a GIL that impairs scalability on computers with more than one processor. The problem seems to be that there is only one GIL per process. Solutions to removing the GIL has always...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.