Threads in Cpp.NET

I have got a code sample off of the MSDN at this address

All I want is to create a thread that waits for a key-stroke to terminate a while loop,
The sample above does exactly that and works when I run it on its own workspace, but when I try to place it into my own project, it doesnt event compile, here is what my code looks like:

void CheckKey( void *dummy );
BOOL repeat = TRUE;

void main(void)
       _beginthread(CheckKey, 0, NULL);
//seperate thread that waits for a key-stroke
void CheckKey( void *dummy )
       repeat = 0;    /* _endthread implied */

But then I get this error:

error C3861: '_beginthread': identifier not found, even with argument-dependent lookup

I have included process.h in the project so I dont think Im missing the header file.
Who is Participating?
Mayank SConnect With a Mentor Associate Director - Product EngineeringCommented:
vassimAuthor Commented:
Its Ok now, I compared the project properties and I found in "Check for 64 bit portability issues" If I change to "No" then it works. I dont know why, but it works and thats the main thing.
BTW had a read of that article and it explained quite a few things about threads, very good for a novice like myself,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.