Solved

Threads in Cpp.NET

Posted on 2004-04-29
2
368 Views
Last Modified: 2007-12-19
I have got a code sample off of the MSDN at this address

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__beginthread.2c_._beginthreadex.asp

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);
       while(repeat)
       {
              ......
              ......
       }
}
//seperate thread that waits for a key-stroke
void CheckKey( void *dummy )
{
       _getch();
       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.
 
0
Comment
Question by:vassim
[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
2 Comments
 
LVL 30

Accepted Solution

by:
Mayank S earned 30 total points
ID: 10958874
0
 

Author Comment

by:vassim
ID: 10959375
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,
Thanks.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Simple Linear Regression
Starting up a Project

707 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