Solved

Threads in Cpp.NET

Posted on 2004-04-29
2
367 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
This code tracks birthdays 3 90
Removing line numbers from left column in config file 7 73
ejb stateless example 2 43
ASP/VB email question 4 62
This is about my first experience with programming Arduino.
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

726 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