Solved

Threads in Cpp.NET

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This is about my first experience with programming Arduino.
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 fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

776 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