473,805 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

_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 (GetExitCodeThr ead(mainthread, &xitcode)&&xitc ode==STILL_ACTI VE)

{

MessageBeep(-1);

Sleep(1000);

}

}

void main()

{

mainthread=GetC urrentThread();

_beginthread(be epthread,0,NULL );

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

}

*************** *************** *************** *************** *************** *
Nov 17 '05 #1
6 1899
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.248.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|Settin gs|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.248.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|Settin gs|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.248.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
5785
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
13065
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 socket inside the thread. I want to destroy the socket and kill the thread at anytime if there is no client connect to it. How?
2
2905
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 little of a newbie to C++. Scales is an array of scale objects and weighup is my method. Scales.thread = _beginthread( Scales.WeighUp, 0, NULL);
5
2230
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? (What I need is a worker thread with a rather large stack in a Windows Forms app complied with /clr:pure) Cheers Jürgen
3
4310
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 LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z) libcimtd.lib(iostrini.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char...
1
4346
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. I think it has something to do with argument lists from what I can find, but I'm really not sure what to do. As in declaring, setting values, passing, and reading them. Thanks for reading.
11
2212
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 stranded on the need for 'fine grained locking' on reference counts. I believe there is a second way, which has been overlooked: Having one GIL per interpreter instead of one GIL per process. Currently, the Python C API - as I understand it - only...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10366
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.