_beginthread()

D

dude

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);

}

****************************************************************************
 
D

dude

Jochen Kalmbach said:
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?
 
J

Jochen Kalmbach

Hi dude,
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/
 
D

dude

Jochen Kalmbach said:
Hi dude,


"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... ;)
 
J

Jochen Kalmbach

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/
 
D

dude

Jochen Kalmbach said:
Hi dude,


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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top